Skip to content

Instantly share code, notes, and snippets.

@tokune
Created May 28, 2012 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokune/2817974 to your computer and use it in GitHub Desktop.
Save tokune/2817974 to your computer and use it in GitHub Desktop.
跨域关闭检测
<SCRIPT LANGUAGE="JavaScript">
window.onload=function(){
document.getElementById("open").onclick=function(){
var url="http://pinban.com/oauth/weibo/binding/";
var win=window.open(url);
var timer = setInterval((function(win){
return function(){
if (win.closed) {
alert("fuck off!!");
clearInterval(timer);
}
};
})(win),1000);
}
}
</SCRIPT>
<input id="open" type="button" value="open"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment