views:

24

answers:

2

Google toolbar is creating a serious problem for me in IE 6 when i try to open a window using window.open or if i set target="_blank" for anchor tag. It treats the window as pop up and dispaly pop up is blocked which i really don't want to dsiplay to my user. This problem only occurs if there is a extra code getting executed before window.open, e.g. calling another method at onclick then using window.open. Can somebody tell me how to solve this issue?

A: 

Adding the site to your Trusted Sites will work.

Setting target="_blank" shouldn't be triggering a pop-up blocker.

Kevin Buchan
hmm no i cannot ask every user to add my site into trusted sites. setting target="_blank" does trigger google toolbar pop up blocker.
Punit
the url is fully qualified url ,takes user to different zone, i have even tried to open "http://www.google.co.in" which also says it is blocked.
Punit
Where I work, we use group policies to push that kind of thing out to all users.
Kevin Buchan
+1  A: 

The toolbar and other devices like that are intended to protect users from unwanted popup windows. The only way for them to determine whether a window is "wanted" is to determine whether window.open is being called in an event handler for a user-initiated event, like a button click. Thus if you try to do something like call window.open on document load, or in an AJAX success handler, the toolbar (and other blockers) will assume that the popup is suspect.

There's nothing you can do about this other than, as noted by Mr. Buchan, tell your users what to expect. Wherever possible, have your popups launched directly from click handlers.

A more radical change would be to shift away from window.open and use simulated popup windows made from floating elements that cover up part of the page. Something, that is, like what jQuery UI dialogs give you.

Pointy