Skip to content

1、jsonp ​

  • script
  • img
  • link
  • iframe
js
function createScript(src){
    const script=document.createElement('script');
    script.src=src+"?callback=func";
}
function func(data){
    console.log(data);
}

2、CORS跨域资源共享 ​

3、http proxy ​

4、nginx反向代理 ​

5、postMessage ​

iframe之间通信。

6、websocket ​

7、window.name+ifame ​

iframe之间通信。

8、document.domain+iframe ​

只能实现一个主域和不同子域之间的通信。

记录 · 实践 · 分享