window.name + iframe前端跨域

概述:

    window.name这个属性不是一个简单的全局属性 --- 只要在一个window下,无论url怎么变化,只要设置好了window.name,那么后续就一直都不会改变,同理,在iframe中,即使url在变化,iframe中的window.name也是一个固定的值,利用这个,我们就可以实现跨域了

代码实例:

test1.html





test1


  

test1页面

test2.html




  
  test2


  

test2页面

使用浏览器访问test1.html:http://192.168.1.10/php_demo/test1.html

运行截图:

window.name + iframe前端跨域_第1张图片

 

参考文献:https://www.cnblogs.com/zhuzhenwei918/p/7403796.html

 

你可能感兴趣的:(js,跨域)