Forum Moderators: open

Message Too Old, No Replies

new windows being blocked

javascript popups

         

graeme

1:05 am on Oct 28, 2004 (gmt 0)

10+ Year Member



Hi, I'm using a <a href="javascript:newwindow('xyz.htm');">xyz</a> code for a few links to create new browser windows with a particular size.

Works fine, but I've had a report of someone (using IE6) saying that the new windows are getting blocked as popups.

Just wondering if anyone else has had this happen to them, and whether there is another way of creating specific sized new browser windows that perhaps aren't seen as popups.

Any info much appreciated. Cheers
G

fish_eye

5:52 am on Oct 28, 2004 (gmt 0)

10+ Year Member



Try this.... In the <head> or in a script file:

<script language="JavaScript">
function pu() {
xyz = window.open('','fred', '<other options (toolbars, size etc)>');
xyz.focus()
}
</script>

and then in the body


<a href="http://www.example.com/" target="fred" onclick="javascript:pu()">blah de blah</a>

This also allows people to right click and "open in new window" if they so choose.

[and it also re-uses the same window and gives it focus if the user did not previously close it - and it keeps the same size if they resized it and did not close it - and it's the most rewarding piece of javascript / html I have ever written :)]