Jennie
Jennie

Reputation: 45

asp.net javascript

In my asp.net project i am using some javascript to open a popup window, its working fine,now let me come to my problem,i have a homepage when i click on login link it opens a popup window,in that popup window i have given register link, when i click register popup will close and registration page opens in seperate page, my problem is how can i open registartion page back in the homepage only.please help me, i hope my explanation regarding the problem is clear, please help me to overcome this problem

Upvotes: 0

Views: 87

Answers (3)

Jennie
Jennie

Reputation: 45

function Reg() { window.close(); var strLocation = ""; var strProfileID = ""; if (top.opener == null){ strLocation = "NewAccount.aspx"; window.location = strLocation; } else{ strLocation = "http://" + top.opener.location.hostname+":"+ window.location.port + "/SendMail/" + "NewAccount.aspx"; top.opener.location = strLocation; top.opener.focus(); } }

Upvotes: 0

Andrew M
Andrew M

Reputation: 9459

I'm not entirely sure you could, as (IIRC) you can't change the URL of another window using javascript. Some Javascript experts might be able to correct me though. - X2 has already beaten me to it! However my next point still stands:

Could you do it without a pop-up at all (because they're annoying and likely to get blocked anyway)? For example by using a hidden Div, that get's displayed as an overlay (like the famous light-box)? Then you're really still on your homepage all along.

Upvotes: 0

x2.
x2.

Reputation: 9668

javascript:window.opener.location="some page"

Upvotes: 2

Related Questions