Why don't I get a 'same origin policy' warning when using the Google Maps API?

后端 未结 2 1308
执念已碎
执念已碎 2020-12-04 07:52

I\'m making a RESTful web service call in my JavaScript page and get the following warning:

\"This page is accessing information that is not under its control. This

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 08:14

    I would like to summarize what the solution was to this problem. You can find a helpful URL here.

    Essentially, you inject code through the pages

    When this is evaluated, the page content returned by the 'src' parameter is:

    myCallback( myParam );
    

    On the server side, you will create a site at that URL that overrides the OnLoad equivalent (with whatever server-side language you are using). Instead of page HTML, the OnLoad will take the URL parameters and re-swizzle them to match the callback call above.

    When the substitution is made, the callback is immediately called when the client loads the page. The benefit of this is that the 'src' URL doesn't have to match the domain of the hosted page.

    Here is what the client HTML page will look like at the end:

    
    
    
                                     
                  
提交回复
热议问题