当前位置:网站首页>admin 系统被嵌套在第三方系统中的跨域异常
admin 系统被嵌套在第三方系统中的跨域异常
2022-07-13 17:38:00 【zq.xc】
页面层级如下
top:www.a.com/index.html
----------------- iframe:www.b.com/page1.html-------------------
----------------- iframe: www.b.com/page2.html-------------------
//此页面访问 window.top 时会指向 www.a.com/index.html 页面,触发浏览器跨域安全异常
----------------- end iframe----------------------------------------------
----------------- iframe----------------------------------------------
在b系统中的通用启动脚本开头加入以下代码
/* 将window.top 和 window.parent 指向当前域下顶层页面 */
(function(){
var cwin = window;
while(cwin != cwin.parent){
try{
var href = window.parent.location.href;
cwin=cwin.parent;
}catch(ex){
break;
}
}
window.top = window.topWindow = cwin;
try{
var href = window.parent.location.href;
window.parentWindow = window.parent;
}catch(ex){
window.parent = window.parentWindow = window;
}
})()
边栏推荐
猜你喜欢

Ardunio -- interaction between touch sensor and light -- judge whether the light is on according to the touch screen

Advanced architects, 16 common principles of microservice design and Governance

ES6--解构赋值(重点)

<statement> or DELIMITER expected, got ‘id‘

万建峰老师 干货分享2022年7月13日

c语言中的输入输出函数之scanf函数

【黄啊码】fastadmin接入微信支付和支付宝支付

Jmeter相关知识整理

ES6--数组

ES6--symbol( )与Map( )
随机推荐
创建/删除 表空间/用户
vue+axios+mysql实现分页查询,条件查询以及批量删除
第一次放生,感觉很奇妙
【黄啊码】MySQL入门—2、使用数据定义语言(DDL)操作数据库
Data operation - query
ES6--symbol( )与Map( )
js作用域与作用域链
垃圾回收机制
Blue Bridge Cup: the second game of the 13th provincial competition of single chip microcomputer group
在线多行文本批量正则替换添加后缀工具
Oracle数据库 错误代码解决办法
What if the system always fails? Maybe you should learn about stability construction
<statement> or DELIMITER expected, got ‘id‘
Kubernetes入坑篇
基于 conda 的在 Win10 上从零开始搞一个 Tensorflow-gpu (2.6.0) 环境的操作记录 (2022.07)
idea发送邮件
【Tensorflow2】AttributeError: ‘Tensor‘ object has no attribute ‘numpy‘ 解决 (tf.py_function)
The 13th provincial competition of Bluebridge cup single chip microcomputer
【vue】keep-alive清除缓存最简单暴力的方法
数据类型与约束