问题
I am developing a custom application feedback tool. The idea is that when the user launches a particular application, I want a pop-up to appear, say a couple seconds after the user launches the application, that asks if they'd be willing to provide feedback. The pop-up will simply be a new IE window. So, something similar in functionality to:
Response.Write("<script>window.open('" + sUrl + "', 'mywindow','resizable= yes,scrollbars= yes');</script>");
We have numerous web apps (ASP.NET) in our company, and I think the quickest solution would be to drop an HttpModule
into the application's solution. For an ideal example, see: http://www.foreseeresults.com/.
QUESTION: Is invoking a new internet browser pop-up possible with an HttpModule
? Or is perhaps invoking JavaScript from an HttpModule
possible on the client's browser?
回答1:
You can achieve this by using ASP.NET HTTP Response Filters.
You implement your custom filter and then set it inside a custom HttpModule
or inside a Global.asax file by handling the PostReleaseRequestState
event.
Bellow is an article by Scott Mitchel on HTTP Response Filters.
http://www.4guysfromrolla.com/articles/120308-1.aspx
This article contains two simple response filters, which should give you the right direction on how to implement your case. I suggest you to display a modal dialog using jQuery and display a message. When user confirms that dialog open a new web page in new window (this way you'll also get around popup blockers).
Hope this helps!
Regards, Uros
来源:https://stackoverflow.com/questions/20333391/can-an-httpmodule-invoke-a-new-ie-pop-up-window