Forum Moderators: phranque
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]
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.
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.