1、 通过jsonp跨域
2、 document.domain + iframe跨域
3、 location.hash + iframe
4、 window.name + iframe跨域
5、 postMessage跨域
6、 跨域资源共享(CORS)
7、 nginx代理跨域
8、 nodejs中间件代理跨域
9、 WebSocket协议跨域
同源策略限制以下几种行为:
1.) Cookie、LocalStorage 和 IndexDB 无法读取 2.) DOM 和 Js对象无法获得 3.) AJAX 请求不能发送
解决方案就是将文字设置为 base64 编码
同源策略主要带来三个方面的行为限制: 1、cookie,localstorage和IndexDB无法读取 2、DOM无法获取 3、Ajax请求不能发送
前端角度解决跨域的三种方法(CORS、JSONP、接口代理)