Update chrome.js

This commit is contained in:
Namhyeon Go 2022-01-09 02:04:06 +09:00 committed by GitHub
parent da671ca7bc
commit 3d15aef7c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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