is there any way to open all target="_blank" links in real browser?
A little help from jQuery makes it possible:
$('a[target=_blank]').on('click', function(){
require('nw.gui').Shell.openExternal( this.href );
return false;
});
Update. In the above code I assume that this.href contains the complete URL even if href="…" attribute does not. This assumption is likely to be true.
i have some iframes shown normal external web page(not node-webkit app).
can i do something to make them all open new window in real browser?
2013/9/30 Mithgol [email protected]
A little help from jQuery http://jquery.com/ makes it possible:
$('a[target=_blank]').on('click', function(){
require('nw.gui').Shell.openExternal( $(this).href );
return false;});In the above code I assume that href="…" attributes of such links contain
complete URLs.—
Reply to this email directly or view it on GitHubhttps://github.com/rogerwang/node-webkit/issues/1162#issuecomment-25338627
.
We could imagine some new linkout attribute and make a feature request to @rogerwang for <iframe nwdisable nwfaketop linkout>.
I support this feature request, but do not forget to cover popup windows al well!
In my application I open insecure external content not in iframes but in those popup windows like here:
require('nw.gui').Window.open(url, {
nodejs: false,
"new-instance": false
});
An option linkout: true would be grand!
I think you can use node-open to do this.
Indeed, these's at least one use case (#1154) where node-open behaves better than Shell.openExternal.
However, here the main problem is that the task of attaching either of those handlers to every _blank link is a large one and thus it's natural to start wondering if the engine could do that for us.
look forward to the linkout attribute
you can now handle it in the new-win-policy handler.
Also you can use the node-open
@sergiovilar That tool was mentioned here 6 months ago.
Oh, Sorry. I don't have seen it
nw.Shell.openExternal('http://google.com');
Most helpful comment
A little help from jQuery makes it possible:
Update. In the above code I assume that
this.hrefcontains the complete URL even ifhref="…"attribute does not. This assumption is likely to be true.