弹出窗口怎样才不被拦截呢

摘要 : Pop-up window is blocked how do not

(1)不要在服务器端的按钮回发事件中写脚本块来调用window.open(),这样肯定被拦结,必须用客户端的超链接或按钮来调用
(2)用<input type=button onclick="window.open()"> 或是<a href="javascript:window.open()"></a> 这两种方式不会被拦结。
(3)在客户端如果想访问服务器端的数据就把数据存在隐藏字段中,这样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" xml:lang="gb2312" lang="gb2312">
<head>
<title> 弹出窗口不被拦截 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="title" content="" />
<meta name="author" content="活靶子,Huobazi,www.AspxBoy.com" />
<meta name="subject" content="" />
<meta name="language" content="gb2312" />
<meta name="keywords" content="弹出窗口不被拦截,GooGle tool bar, 3721" />
<meta name="Copyright" content="www.AspxBoy.com" />
<meta name="robots" content="all" />
<script language="JavaScript">
function OpenWin()
{
    window.showModelessDialog('myttt.html','','dialogWidth:1px;dialogHeight:1px;dialogTop:1;dialogLeft:1;');
    document.all.a1.focus();
}

</script>
<style>
#div{
    width: 400px;
    padding: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-right: auto;
    margin-left: auto;     
    background: #FFF;
    border: 2px solid #000000;
    text-align:left;
    width: 400px;
    voice-family: "\"}\"";
    voice-family:inherit;
    width: 370px;
    font-size:12px;


}
html>body #div {
    width: 370px;
    }
</style>
</head>
<body onload="OpenWin();">
<div id="div">
<br />
<br />
<br />我们在这个页面弹出一个窗口,试试看能被Google,3721等工具条拦截呢?
<br />
<br />
<br />
<br />
    <div >
    <a id="a1" href="view-source:http://www.aspxboy.com/popwindow/index.html" >查看代码1</a>
    </div>
    <div>
    <a id="a2" href="view-source:http://www.aspxboy.com/popwindow/myttt.html" >查看代码2</a>
    </div>
</div>


</body>
</html>
上一篇 :WIN2008下IIS7官方URL重写转向(UrlRewrite)模块
下一篇 :Linq 在绑定控件后,DataItem的用法