Sumit
Sumit

Reputation: 165

How to get Parent page URL by Javascript?

I have a scenario where Im opening a modal window dailog from Page1.aspx. Now after opening the modal window dialog If a user copies a URL and tries to open that window dialog directly from the browser. The modal window dialog shouldn't open directly. It should open ONLY from Page1.aspx. How do I check if user has not opened it directly in the browser. Basically Im looking for a substitute of URLReferrer in javascript.

Any help would be appreciated.

Thanks & regards,

Sumit Arora

Upvotes: 0

Views: 4602

Answers (2)

Fahad Hussain
Fahad Hussain

Reputation: 1185

You can check the parent with window.parent.

Upvotes: 1

Marwan
Marwan

Reputation: 2402

Kindly to using this line of script

if(window.opener)
  {
   var locationOfParentWin =  window.opener.location.href;
  }

Regards

Upvotes: 1

Related Questions