diff --git a/lib/chrome.js b/lib/chrome.js index 6f7e1bd..6df5b1e 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -28,6 +28,7 @@ var ChromeObject = function() { "port": 1080 }; this.inPrivate = false; + this.userAgent = null; // dependencies this.oAutoIt = null; @@ -169,6 +170,11 @@ var ChromeObject = function() { return this; }; + this.setUserAgent = function(ua) { + this.userAgent = ua; + return this; + }; + this.open = function(url) { this.setProfile(this.profileName, this.installedDir); @@ -256,6 +262,9 @@ var ChromeObject = function() { // set user data directory cmd.push("--user-data-dir=\"" + this.userDataDir + "\""); + + // set user agent + cmd.push("--user-agent=\"" + this.userAgent + "\""); // set URL cmd.push("\"" + url + "\""); @@ -476,8 +485,8 @@ var ChromeObject = function() { } } - // calling `onfocus` event - this.dispatchEvent(new STD.Event("focus")); + // calling `onfocus` event + this.dispatchEvent(new STD.Event("focus")); return title; };