Bug (regression) : new-win-policy event not always thrown on popup opening in iframe
See original GitHub issueHi Roger, I’m using the iframe object for embedding a web site. It’s working pretty very well (thank you) but depending on how a popup is openin this web site, I can or can’t get (and catch) the new-win-policy event (This has been tested with version 0.11.3. Windows 32 bits).
What is working:
- If you click on one link with key shift pressed.
What is not working:
- You click on a link that is supposed to open a popup.
For instance, the code below works well if you open it from a local file but doesn’t it you use the web site it has been picked of. I don’t really understand why because if you consider the html tag anf the javascript code, the popup is open with a standard window.open call.
To reproduce the issue:
This is the hosted nw iframe I’m using (see url inside):
<iframe name="myIframe" id="myIframe" src="http://www.airfrance.fr/FR/en/local/home/home/HomePageAction.do" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto" onLoad="isLoaded();" allowtransparency="false" nwdisable nwfaketop></iframe>
Obviously, I’m catching the new-win-policy on the window containing this frame.
I’ve put the screenshot with the image link you have to click on to open a new window.
And here is the extract of the link on the remote page and the associated javascript code :
<a class="cutout_lien" href="https://shopping.airfrance.com/boutique/fr/E-SHOPPING-GRAND-PUBLIC3/index.htm" onclick="javascript:af_open(this);return false;" rel="1[,]"><h2 class="cutout_titre">Nos coups de cœur<br>Air France Shopping</h2><img alt="Air France Shopping" src="http://www.airfrance.fr/common/image/visuels_detoures/shopping.png" height="115" width="230"></a>
function af_open(elem){
var t = elem.title || elem.name || '';
var a = elem.href || elem.alt;
var p = elem.rel || false;
var m = "0";
var l = 800;
var h = 600;
if(a==document.location.href){return false;}
if(p){
//on recupere la largeur et la hauteur
var r = p.match(/^\s?([0-2])\s?\[\s?([0-9]*)\s?,\s?([0-9]*)\s?\]/g);
m = RegExp.$1.toString();
l = RegExp.$2.toString();
h = RegExp.$3.toString();
}
if(m.match(/2/)){
if(l.length==0 && h.length==0) {
GB_showResize(t,a);//Fonction GreyBox (popin auto resize)
} else {
GB_showCenter(t,a,l,h);//Fonction GreyBox (popin taille fixe)
}
} else if(m.match(/1/)){
window.open(a,t);
} else {
document.location = a;
}
return false;
}
<bountysource-plugin>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
I believe that this is happening when loading a chrome app. The chrome packaged apps do not seem to have a node context. Any idea on a fix or suggested work around?
Hello to all, I confirm it’s really a regression. I have tested the same code (see extract below) with an older version (0.9.2 win32) on the same web site and it was working well (in other words, the function was well called when opening a popup window clicking on one link).
I hope you will be able to fix it !
Thanks.