浏览器跨域问题解决方案

浏览器跨域问题解决方案

参考:
https://developer.yahoo.com/javascript/howto-proxy.html?guccounter=1
http://www.cnblogs.com/rainman/archive/2011/02/20/1959325.html

直接使用ajax

clt_ip_temp.html:1 Failed to load http://127.0.0.1:8010/adverter/js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

方法二:

    var ifoo = '<script src="http://127.0.0.1:8010/adverter/js"><\/script>';
    document.write(ifoo);

提示:

clt_ip_temp.html:88 A parser-blocking, cross site (i.e. different eTLD+1) script, http://127.0.0.1:8010/adverter/js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.

20180822:
in Opera
window.top.location=’//’

async_usersync.html:4 GET https://ads.stickyadstv.com/user-registering?dataProviderId=593&userId=91bjRc6Q1FS50E5 0 ()
AN_async_load @ async_usersync.html:4
(anonymous) @ async_usersync?cbfn=AN_async_load:1
window.top.location.href='//baidu.com'
VM1811:1 Unsafe JavaScript attempt to initiate navigation for frame with URL 'https://www.fakenamegenerator.com/' from frame with URL 'https://www.fakenamegenerator.com/'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.

(anonymous) @ VM1811:1
VM1811:1 Uncaught DOMException: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to '//baidu.com'.
    at :1:25
(anonymous) @ VM1811:1

你可能感兴趣的:(web安全)