Forum Moderators: phranque

Message Too Old, No Replies

New version of firefox not behaving with javascript

on click open window closing itself

         

Bewenched

3:39 pm on Mar 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I noticed something this morning while running through the site

We have an onclick event that opens a larger photo of a product. However we also have an onblur="self.close()" event to close it if they click back to the main page or anywhere else. Unfortunately now it pops open and immediately closes without any clicking ... just opens then immediately closes.

Version of firefox
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10

Anyone else experiencing this?

[edited by: Bewenched at 3:39 pm (utc) on Mar. 2, 2007]

physics

6:57 pm on Mar 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had an issue like this recently too.
Are you running ZoneAlarm?
If so go into the config and turn off aggressive popup blocking.

rocknbil

7:22 pm on Mar 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



onBlur() is a tricky event to deal with because you never know when the browser is going to move focus from the window. I suspect when the window opens it's automatically focusing on something else, and there's your onBlur().

You might try approaching it differently, assign an ID to the new window you open, then use an onClick in the main window to close any windows with that ID that may be open.

Bewenched

2:48 am on Mar 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No I'm not using zone alarm. On this particular machine I'm running XP Professional.

This is not an automatic popup. The user has to click on the icon to see a larger image, then if they click to the main window or right/left click (to steal an image) it automatically closes. It had been working fine in all browsers including firefox until I noticed it today.

Here's part of the code

<body onload="resize(); self.focus()" onblur="self.close()" bgcolor="#FFFFFF" text="#000000" link="#CC0000" vlink="#CC0000" alink="#CC0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

the resize function examines the image or images and resizes the window to fit them.. nifty little script.

<script type="text/javascript">

<!--
var i=0;
var s=0;
function resize() {
if (navigator.appName == 'Netscape') i=40;
if (window.navigator.userAgent.indexOf("SV1")!= -1) s=20; //This browser is Internet Explorer in SP2.
if (document.images[0]) window.resizeTo(document.images[0].width +35, document.images[0].height+65-i+s);
self.focus();
if (document.images[0]) {
imgHeight = document.images[0].height+120-i;
imgWidth = document.images[0].width+30;
var height = screen.height;
var width = screen.width;
var leftpos = width / 2 - imgWidth / 2;
var toppos = height / 2 - imgHeight / 2;
window.moveTo(leftpos, toppos);
window.resizeTo(imgWidth, imgHeight+25);

}
}
//--></script>

Any ideas? I'd really really hate to have to remove the script since so many people were hot linking or flat out taking them. I just downloaded the newest version of firefox and it's doing it too.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2

-----------
Note, I tested this on my Windows Vista machine running the same version of firefox and it works flawlessly. And it also works fine on an older version of XP w/firefox and windows 2k at the office.

physics

11:32 pm on Mar 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Firefox auto-updated and now I'm having a similar issue. A popup that was working fine before is now getting killed (not an ad, an essential part of the site). I think the Firefox team is being too aggressive in terms of anti-popup coding (though I can't find anything in the release notes about this). Just allow someone to allow popups or not for a site. If they do allow them then let the popups function properly (please!).