Determine if aspx page was opened with window.open () command

Is there a way to define in the code of the child page behind which was opened by the window.open () javascript command from the parent page?

The popup page contains a custom control that is used by other pages that are not generated from the window.open () command, and I want to dynamically add functionality to close the page after the user has completed their task in the child page.

This is ASP.NET C # 3.5 application.

+1


source to share


5 answers


Can you pass a flag in the query string that will indicate where the window was spawned from?



+5


source


in javascript you can check if window.opener is null



+3


source


The request for the child window will probably have an HTTP Referer

(referrer) header that points to the parent page. You can check this on the backend or check window.opener

on the client side.

+1


source


You may be wrong, but I don't think there is an easy straight forward way to do this. You can always try to define it from a separate url, eg. "MyChildForm.aspx? From = winopen"

- Edit-- Beat him up Galvegyan

0


source


You can add some javascript to the usercontrol to check if window.opener is not non-null and based on that hide or show the user interface of the closed page.

0


source







All Articles