Hello, welcome toPeanut Shell Foreign Trade Network B2B Free Information Publishing Platform!
18951535724
  • Ii. Use of jsonp to reference to common limitations

       2026-02-26 NetworkingName810
    Key Point:Co-source policy 1. What is co-sourceIf the two pages have the same protocols, domain names and ports, then the two pages belong to the same source, which is different if one is different2. Purpose of the co-source policyThe co-source policy is designed to ensure the security of user information and prevent the theft of data from malicious websites. The original co-source policy is the c set by a website on the client sideLookie, website b is not

    Co-source policy 1. What is co-source

    If the two pages have the same protocols, domain names and ports, then the two pages belong to the same source, which is different if one is different

    2. Purpose of the co-source policy

    The co-source policy is designed to ensure the security of user information and prevent the theft of data from malicious websites. The original co-source policy is the c set by a website on the client sideLookie, website b is not accessible

    With the development of the internet, the homogenous policy has become increasingly stringent, with one of the provisions being the inability to send ajax requests to non-consistent addresses, and if requested, the browser will miss。

    Ii. Use of jsonp to address congener limits 1. What is jsonp

    Jsonp is the abbreviation of json with padding, which does not belong to the ajax request, but it can simulate ajax request, which is an unofficial cross-domain solution and only supports the get request

    How does jsopn work

    Explain the principle of jsonp

    Some web pages have specific cross-domain capabilities, e. G. Amg, lInk, ifI'm sorryCript

    Jsopn is using sCript's cross-domain capability to send requests

    3. Use of jsonp

    (1) request address of server from different sources in sIn the src attribute of the cript tag

    "www. Example. Com"I'm sorry

    (2) server-end response data must be a function call, and data that is really sent to the client needs to be used as a function call parameter

    (3) define function under client global domainf

    Funaction {\data}

    Set function definition in sCript tag front and defined in global domain

    Explain the principle of jsonp

    (4) processing of data returned by the server within fn

    Iii. Jsopn code optimizing 1Cript sent requests into dynamic requests

    
        
        I'm sorry. Function n(data){
    okay, console'the client function is calledI'm sorry. Console. Log (json. Stream(data));
    ♪ i'm sorry ♪I'm sorryI'm sorry. Co=dI'm sorry, i'm sorry'buttonI'm sorry. I don't knowNclick = effect(){
    coI don't knowCript =dI'm sorry, i'm sorry'sCriptI'm sorry. SI'm sorry, cript'http://localhost:30000/server2';
    dI don't know, document. Body. Appendchild(e) cript;
    ///resumption of sending
    sI don't knowNload = effect(){
    dI don't know what you're talking about(e) cript;
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪I'm sorry

    Client needs to pass the function name to the server end

    Before the client changes the name of the function to influence the server to change repeatedly

        
        I'm sorry. Function n(data){
    okay, console'the client function is calledI'm sorry. Console. Log (json. Stream(data));
    ♪ i'm sorry ♪I'm sorry== sync, corrected by elderman == @elder manI'm sorry

    I don't know'/server2 1', (req, res) = {
    i don't know'access-control-allow-origin'..,'*I'm sorry. Co{\chffffff}{\ch00ff00} {\chffffff}{\ch00ff00} {\chffffff}{\ch00ffff}
    coNst result =fnname+'(name: "chang woo chan")';
    res. Send (result);
    ♪ i'm not sure ♪

    3. Encapsulating jsonp functions to facilitate the sending of requests

    I don't know

    Section jsonp(options){
    / dynamic creationsCript tag
    coI don't knowCript =dI'm sorry, i'm sorry'sCriptI'm sorry.
    / yeah, yeah, yeah, yeahCript adds src property
    s= options. Url;
    / willsCript add to page
    dI don't know, document. Body. Appendchild(e) cript;
    // deleting after jsonp loadsCript tag
    sI don't knowNload=()=>
    dI don't know what you're talking about(e) cript;
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

        
        ".././jsonp. Js"I'm sorryI'm sorry. Function n(data){
    okay, console'the client function is calledI'm sorry. Console. Log (json. Stream(data));
    ♪ i'm sorry ♪I'm sorryI'm sorry. Co=dI'm sorry, i'm sorry'buttonI'm sorry. I don't knowNclick = effect(){
    jsonp({)
    url:'http://localhost: 3,000/server2 1? Callback=fn♪ i'm sorry ♪
    ♪ i'm not sure ♪
    ♪ i'm sorry ♪I'm sorry

    Explain the principle of jsonp

    4. Functions associated with sealed jsonp functions, functions

    The call function in jsonp is no longer a global function

    Generate a random function name to prevent multiple calls to the jsonp function, overwrite the front side of the back

    Section jsonp(options){
    / dynamic creationsCript tag
    coI don't knowCript =dI'm sorry, i'm sorry'sCriptI'm sorry.
    / /jsonp calling function when successful/failed is no longer a global function
    / random function name to prevent multiple calls to the jsonp function, override the front side of the back
    coNst nnname='myjsonp' + math. Random(). Tostrring(). Replace()'cause...'..,♪ i'm sorry ♪I'm sorry. Windows [fnname] = options. Access;
    / yeah, yeah, yeah, yeahCript adds src property
    s= options. Url +'? Callback'+fnname;
    / willsCript add to page
    dI don't know, document. Body. Appendchild(e) cript;
    // deleting after jsonp loadsCript tag
    sI don't knowNload=()=>
    dI don't know what you're talking about(e) cript;
    ♪ i'm sorry ♪
    ♪ i'm sorry ♪

    5. Collapse the requested parameters behind the requested address

    /close request parameters to the back of the address
    var params =♪ i'm sorry ♪';
    for (var attr in options. Data)
    params +='""'+attr '+'=' + options. Data [attr];
    ♪ i'm sorry ♪
    s= options. Url +'? Callback'+fnname+params;
     
    ReportFavorite 0Tip 0Comment 0
    >Related Comments
    No comments yet, be the first to comment
    >SimilarEncyclopedia
    Featured Images
    RecommendedEncyclopedia