Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep focus on a windows with help of addEventListener

Status
Not open for further replies.

Pichdude

Programmer
Aug 24, 2005
66
SE
Hi!

I have a webpage which opens a new page with a link like this:
<a href="#" onclick="openInfoWindow('xxx.jsp', 600, 800)">Link</a>

Can anybody help me on how I can control so that the focus is always on the new window, e.g. the user can not access the original webpage until the new one (xxx.jsp) is closed. I guess by the help of a eventlistener, but I am not sure how to use it.

Regards

Pichdude
 
You will NOT be able to do this without opening a modal window - which restricts you to IE only.

There is NO guaranteed cross-browser way of stopping access to a main window while a popup is open.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Crap! ;-)

I'm just curious, why is it not possible to do it without using modal window?

Regards,

Pichdude
 
You could put the content in a <div> element and position this div over the current page instead of working with a pop-up window. Pop-up windows aren't even crossbrowser too, Firefox blocks them :)

 
Pop-up windows aren't even crossbrowser too, Firefox blocks them

They are cross-browser. Just because Firefox includes a popup blocker, does not mean that it doesn't support them. If anything, it indicates that it does support them!

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I see a popup blocker in Safari and Firefox (for the Mac) and there are toolbar add-ons that add that functionality to Firefox (although it has one built-in) and IE (for Windows) -- that I can think of immediately.

"popups" use the javascript window.open construct (and in fact do nothing more than trigger some javascript to invoke a new window at some specific size etc). This javascript has been supported in browsers since forever (well, almost).

The suggestion to cover the page with a div (and you could put a transparency filter on that div to effectively dim the contents of the page) and then put the "popup" window as a div on top of that... is a totally valid way to achieve the same (kind of) effect.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top