popup for web application


I need a some javascripts that open a popup window when the user clicks a hyperlink and redirects the main window to a certain page.

<a href="index.php?check=true&target=manager&action=open" onClick="window.open('manager.php',...)>link</a>

(this works)

But I want that the main window redirects to page A when the popup is succesfully opened, if the popup didn't open (it's the main interface of the application), the main window should be redirected (window.location or something)  to page B. And finally, the main window should go to page C when the popup is closed. It's important that the popup stays focused when the main window is redirected to page A for example. I tried window.opener.location, but the main window receives focus when it's edited.

In short

1) open popup when user clicks link
2) if popup is success -> redirect main window to page A
3) if popup isn't success (by a popup blocker for example) -> redirect main window to page B
4) if popup is closed by user -> redirect main window to page C

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
1, 2, 3:

Assuming the given href is page a

<a href="index.php?check=true&target=manager&action=open"
if (!w) this.href='pageb.html'">link</a>

4: in pagea or b:
body onUnload="if (opener && !opener.closed) opener.loction='pagec.html'"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thiverAuthor Commented:
4) The close script works when you put the code in the manager.php file (popup content file).

3) This script doesn't work, I tested it with different pop-up blockers, and every time the main window goes to page A ("popup succesful message), even when the popup is blocked.
thiverAuthor Commented:
Sorry, I made a little mistake.

3) Is working fine!

Michel PlungjanIT ExpertCommented:
So why the "B"?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.