NW.js:Clicking on a link to an open website does not trigger the 'new-win-policy' event

27 Views Asked by At

When I open a new website with nw and click the link in it, most of the time, the 'new-win-policy' event will not be triggered, so I cannot get the window object of the new window and cannot control the window opened by the link. What should I do to control the newly opened window?

 nw.Window.open(url, {
    width: 1200,
    height: 850,
    x:200,
    y:50,
    focus:true,
    frame:true,
    always_on_top: false,
    
},function(e){
    // e is new Window click Click the link inside Does not fire the 'new-win-policy' event for this new window
    e.on('new-win-policy',function(a,b,c){
        console.log(b)
        c.ignore();
        e.window.location.href = b;
    })
});
0

There are 0 best solutions below