`
duanyong
  • 浏览: 92496 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

非同域如何刷新父域的地址

 
阅读更多
//需要跳转的地址
var url = "http://duanyong.tk";

if(self !== top){
	try{
		top.location.replace(url + Math.random());
	}catch(e){
		try{
			top.location = url + Math.random();
		}catch(e){}
	}
}

 

解决不同域之间跳转,这是浏览器的bug,所以需要随时注意是否可通.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics