asp.net弹出新的页面,如何不被百度工具栏屏蔽而打不开?100分,解决立马给分 有个ImageButton(点击登陆),在ImageButton点击事件里执行这样的功能:登陆成功后新开个页面,弹出一个新页面,但是一般方法会被工具栏屏蔽,(window.open()这类的不行)很是难办,总不能叫用户都把工具栏关了把,而且现在的工具栏基本都是流氓软件,卸不了的,各位有什么好办法吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Note.Web.WebForm3" %><!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 runat="server"> <title>无标题页</title> <script type="text/javascript" language="javascript"> var isMSIE= (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器 function myWindow(){};myWindow.openSMD = function(strURL,strWindowName,intWidth,intHeight) { var x = parseInt(screen.width / 2.0) - (intWidth / 2.0); var y = parseInt(screen.height / 2.0) - (intHeight / 2.0); if (isMSIE) { retval = window.showModalDialog(strURL, strWindowName, "dialogWidth:"+intWidth+"px; dialogHeight:"+intHeight+"px; dialogLeft:"+x+"px; dialogTop:"+y+"px; status:no; directories:yes;scrollbars:no;Resizable=no; " ); } else { var win = window.open(strURL, strWindowName, "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + intWidth + ",height=" + intHeight + ",resizable=no" ); eval('try { win.resizeTo(width, height); } catch(e) { }'); win.focus(); } } </script> </head><body> <form id="form1" runat="server"> <div> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton> </div> </form></body></html>using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;namespace Note.Web{ public partial class WebForm3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void LinkButton1_Click(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>myWindow.openSMD('xxx.aspx','new',500,400);</script>"); } }} showModalDialog() OR Redirect() 重装或升级一下IE,,在IE工具--弹出窗口阻止程序--弹出窗口阻止程序设置--加入你的站点... 就是正常的打开,就跟<a href="xx.aspx" target="_blank">asds</a>的效果一样 不用imagebutton和linkbutton。用户体验不太好将imagebutton换成image,后台代码里写image.attributes.add("onclick","window.open()")这样试试,好像不阻止了 showModalDialog() 或者框架隐藏 iframe点击显示 用模态窗口window.showModalDialog或者弹出层都方式 (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> 如何通过.ashx文件控制页面中DIV的显隐? 求救啊 asp.net网站编译无效 修改代码无效 DataView的RowDataBound事件怎么样放两个连接传值???(急) 网站的维护问题 在asp.net中如何实现如此酷的浮动窗口效果? 关于DropDownList的困惑(帮顶有分) asp.net 中如何绑定实体集合? 各位大侠帮帮忙,万分感谢 20 邮件发送失败。求解决 请问下大家,一般怎么分析网站现在运营情况和硬件,网络,数据库的负载情况呢 请问在哪设置DetailView的单元格样式啊?????
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Note.Web.WebForm3" %><!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 runat="server">
<title>无标题页</title>
<script type="text/javascript" language="javascript">
var isMSIE= (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器 function myWindow(){};myWindow.openSMD = function(strURL,strWindowName,intWidth,intHeight)
{
var x = parseInt(screen.width / 2.0) - (intWidth / 2.0);
var y = parseInt(screen.height / 2.0) - (intHeight / 2.0);
if (isMSIE)
{
retval = window.showModalDialog(strURL, strWindowName, "dialogWidth:"+intWidth+"px; dialogHeight:"+intHeight+"px; dialogLeft:"+x+"px; dialogTop:"+y+"px; status:no; directories:yes;scrollbars:no;Resizable=no; " );
}
else
{
var win = window.open(strURL, strWindowName, "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + intWidth + ",height=" + intHeight + ",resizable=no" );
eval('try { win.resizeTo(width, height); } catch(e) { }');
win.focus();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
</div>
</form>
</body>
</html>using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;namespace Note.Web
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ } protected void LinkButton1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>myWindow.openSMD('xxx.aspx','new',500,400);</script>");
}
}
}
将imagebutton换成image,后台代码里写image.attributes.add("onclick","window.open()")这样试试,好像不阻止了
或者框架隐藏 iframe点击显示
或者弹出层都方式
(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>