当前位置: 代码迷 >> JavaScript >> 挟制弹出窗口的javascript
  详细解决方案

挟制弹出窗口的javascript

热度:110   发布时间:2012-10-24 14:15:58.0
强制弹出窗口的javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Pop Ads</title> 
<script language="javascript"> 
<!--
function ForceWindow ()
{
this.r = document.documentElement;
this.f = document.createElement("FORM");
this.f.target = "_blank";
this.f.method = "post";
this.r.insertBefore(this.f, this.r.childNodes[0]);
}
ForceWindow.prototype.pop = function (sUrl)
{
this.f.action = sUrl;
this.f.submit();
}
window.force = new ForceWindow();
</script> 
</head> 
<body onload="window.force.pop('http://lveyo.iteye.com/')"><br /> 
 
</body> 
</html>


这个一般拦截不了,构造了一个空FORM提交到要打开的URL上,很实用。
  相关解决方案