admin管理员组文章数量:1391929
Is there a way to determine in the child page's code behind that is was opened by the window.open() javascript mand from the parent page?
The pop-up page contains a user control that is used by other pages that are not spawned from a window.open() mand and I want to dynamically add functionality to close the page after the user has pleted their task in the child page.
It is an ASP.NET C# 3.5 application.
Is there a way to determine in the child page's code behind that is was opened by the window.open() javascript mand from the parent page?
The pop-up page contains a user control that is used by other pages that are not spawned from a window.open() mand and I want to dynamically add functionality to close the page after the user has pleted their task in the child page.
It is an ASP.NET C# 3.5 application.
Share Improve this question asked Dec 17, 2008 at 17:13 Michael KniskernMichael Kniskern 25.3k70 gold badges169 silver badges233 bronze badges5 Answers
Reset to default 5Can you pass through a flag in the querystring which will indicate where the window was spawned from?
in javascript you can check if window.opener is null
The request for the child window will probably have an HTTP Referer
(referrer) header that points to the parent page. You could check that at the backend or check window.opener
on client side.
Might be wrong, but I don't think there's a simple direct way to do this. You could always try to identify it from a distinct url, e.g. "MyChildForm.aspx?from=winopen"
--Edit-- Beaten to it by Galwegian
You could add some javascript in the usercontrol to test whether window.opener is non-null and on that basis hide or show the close page UI.
本文标签: cDetermine if aspx page was opened by a windowopen() commandStack Overflow
版权声明:本文标题:c# - Determine if aspx page was opened by a window.open() command - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744695355a2620245.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论