From: me on 31 Jul 2010 10:35 "Lasse Reichstein Nielsen" <lrn.unread(a)gmail.com> wrote in message news:y6csko16.fsf(a)gmail.com... > I just tried that, and it works for me, so we need more information. > I.e. you should answer the questions: What did you do? What did you > expect to happen? What actually happened? (In sufficient detail so > that we can reproduce, recognize and repair the error). I made a simple test that demonstrates the unexpected Chrome behaviour; This is "testmain.htm": <HTML><HEAD> <TITLE>main</TITLE> <SCRIPT TYPE="text/javascript"> function addEvents() { document.getElementById("id1").onclick = imgPop; document.getElementById("id2").onclick = imgPop; } function imgPop() { window.vLink = this; alert("main: vLink.id=" + window.vLink.id); var PopWin = window.open("", "PopUpWindow"); if (! PopWin.vImage) { PopWin.location = "testpop.htm"; } else { PopWin.opener = self; PopWin.ImageProps(); } PopWin.focus(); return(false); } </SCRIPT> </HEAD> <BODY onLoad="addEvents()"> <A ID="id1" HREF="photo1.jpg"><IMG SRC="thumb1.jpg" ALT="alt 1"></A> <A ID="id2" HREF="photo2.jpg"><IMG SRC="thumb2.jpg" ALT="alt 2"></A> </BODY></HTML> and this is "testpop.htm": <HTML><HEAD> <TITLE>pop-up</TITLE> <SCRIPT TYPE="text/javascript"> function InitPop() { if (! window.opener || window.opener.closed || ! window.opener.vLink) { alert("closing pop-up; vLink=" + window.opener.vLink); window.close(); } window.vImage = new Image(); ImageProps(); document.body.appendChild(window.vImage); } function ImageProps() { window.vImage.src = window.opener.vLink.href; window.vImage.alt = window.opener.vLink.firstChild.alt; document.title = window.vImage.alt; } </SCRIPT> </HEAD> <BODY onLoad="InitPop()"> </BODY></HTML> This should give a page with two thumbnails; if you click a thumbnail, an image opens in a new window, and the window title is set to the alt text of the thumbnail. If you click a thumbnail while the pop-up window is already open, the window gets re-used. The "opener=self" line is there to take possession of the pop-up window in case it was opened by another instance of testmain.htm; that way, several instances share the same popup window. This test performs as described in IE7 and FF3.6. In Chrome 5.0 (latest version), the popup immediately closes again, because window.opener.vLink is undefined. I tested with local files. Marc.
From: me on 31 Jul 2010 10:45 Hello again, I put a version online, and there it works as expected. It appears to be a security settings problem in Chrome after all. Now I'll go and try to add localhost to trusted sites or something... Thanks to everyone who responded ! Marc. ---- "It's not a list" LOL
From: Luuk on 31 Jul 2010 11:18 Op 31-07-10 16:45, me schreef: > Hello again, > > I put a version online, and there it works as expected. > It appears to be a security settings problem in Chrome after all. > Now I'll go and try to add localhost to trusted sites or something... > Thanks to everyone who responded ! > > Marc. > ---- > "It's not a list" LOL > > no problem here, also not when testing on localhost Chrome version: 5.0.375.125 -- Luuk
First
|
Prev
|
Pages: 1 2 Prev: qooxdoo trouble Next: 100% free dell laptaps offerd by dell and Vodafone companies. |