How to get http headers from opened window?

494 views
Skip to first unread message

dexcel...@gmail.com

unread,
Mar 9, 2015, 10:41:07 AM3/9/15
to nwjs-g...@googlegroups.com
Let's say i open a website in new window using code like this

var win = gui.Window.open('https://github.com');

How do i get the http response headers from github in win object? 

Thank you.

feli...@tweakstyle.com

unread,
Mar 9, 2015, 11:13:16 AM3/9/15
to nwjs-g...@googlegroups.com, dexcel...@gmail.com
You can use chrome webrequest API, available in NWJS since v0.12.0

The following snippet will log all responseHeaders from all requests (including css, js, ...):

chrome.webRequest.onResponseStarted.addListener(
function(details) { // https://developer.chrome.com/extensions/webRequest#event-onResponseStarted
console.log(details.responseHeaders);
},
{urls: ["<all_urls>"]}, // filter: change this to catch only request(s) you're interested in https://developer.chrome.com/extensions/webRequest#subscription
["responseHeaders"] // extra options. "responseHeaders" option is required to get responseHeaders in details object
);
var win = gui.Window.open('https://github.com');

Pier Bover

unread,
Mar 9, 2015, 11:17:19 AM3/9/15
to nwjs-general
Is it possible to use the Chrome app api too in NWJS?

For example chrome.usb?

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Félicien Francois

unread,
Mar 9, 2015, 11:32:46 AM3/9/15
to nwjs-g...@googlegroups.com
For now only a few Chrome App APIs are available in NWJS (webview and webrequest since 0.12.0).

More APIs may be oppened in next releases https://github.com/nwjs/nw.js/issues/518



--
You received this message because you are subscribed to a topic in the Google Groups "nw.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nwjs-general/cK3rXac2MPE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nwjs-general...@googlegroups.com.

Pier Bover

unread,
Mar 9, 2015, 11:44:00 AM3/9/15
to nwjs-general
Thanks Felicien.

It would be awesome if we had bluetooth, serial, and usb capabilities in nwjs.
Reply all
Reply to author
Forward
0 new messages