Search code examples
node-webkit

is it possible change user-agent for a single window?


I open a second window like that... its possible change the user-agent or other values for this window??

var new_win = gui.Window.open('http://google.com', {
    position: 'center',
    width: 300,
    height: 300 
    //,show: false 
}); 

I need change randomly this params(headers) for that my application works fine.

im using:

node-webkit v0.11.4
node.js v0.11.13-pre
Chromium 38.0.2125.104
commit hash: fa7a807-d8ecacd-e98a5c7-f2f89e2-d9a9d39-cdd879e

Solution

  • I don't find any solution to change the user-agent in Window.open.

    But you can use iframe#nwUserAgent to change it .

    For example:

    index.html

    var new_win = gui.Window.open('iframe.html', {
        position: 'center',
        width: 300,
        height: 300 
        //,show: false 
    }); 
    

    iframe.html

    <iframe src="http://google.com" nwUserAgent="test" style="width:100%;height:100%"></iframe>