简体   繁体   English

在.NET Web应用程序中使用Response.Redirect到弹出窗口的最佳方法是什么?

[英]What's the Best Way to use Response.Redirect to for A Pop-Up in a .NET Web Application?

我正在尝试这样做,以防止最终用户浏览器安全功能(例如弹出窗口阻止程序)妨碍我的应用程序。

There is no way to disable pop-up blockers to prevent opening pop-ups. 无法禁用弹出窗口阻止程序以防止打开弹出窗口。

Why do you want to use Response.Redirect? 为什么要使用Response.Redirect? I find its best to inject javascript using this method: 我发现最好使用这种方法注入javascript:

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "PopUp", "window.open([url]);", true);

Another possibility is to use a modal dialog or floating iframe window to show other content on the current page. 另一种可能性是使用模式对话框或浮动iframe窗口在当前页面上显示其他内容。 jQuery is great for this. jQuery对此非常有用。

For example, check out jQuery impromptu if you're interested in simple messages/dialogs 例如,如果您对简单的消息/对话框感兴趣,请查看jQuery即兴

jQuery Impromptu jQuery即兴

"Use for a pop-up" how? “用于弹出”如何? You want the redirect to create the pop-up? 您要重定向来创建弹出窗口吗?

That can't be done. 那是不可能的。 A redirect is a return status from the request made by a particular browser window. 重定向是特定浏览器窗口发出的请求的返回状态。 Responses don't create windows. 响应不会创建窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM