Hello everyone.
i am writting a function (imgWindow(url), located on an external .js file ) where you pass the url of an image and it will open a new window with the image’s dimensions, the problem is that the [B]first[B] second, third
the second function tryClose(), tries to prevent multiple instances of the window, and to close all the opened windows when the main page is unloaded. (so far it does what it is supposed to)
[CODE]var win=””
function imgWindow(url)
{
var img = new Image();
img.src = url;
var w = img.width;
var h = img.height;
//alert(w+”,”+h);//testing purposes
tryClose();
win = window.open(url,”,config=”height=”+h+”,width=”+w+”,location=no,status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=no,directories=no”);
win.document.write(“<html><head><title>My Image Viewer</title></head><body style=’margin:0′><img src='”+url+”‘ title=”+url+” ></body></html>”);
}
function tryClose()//this will be executed at onUnload too
{
if(!win.closed&&!win==””)
{
win.self.close();
}
}
I believe this has to do with some sort of cache, since it only happens the first time the image is used.
any help will be very appreciated.