mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-11 01:32:04 +00:00
Override user agent by default,
- Remove `--pretend` flag. Pass `--honest` instead to disable the fake user agent
This commit is contained in:
parent
59e9f6e104
commit
a6e580aa0a
22
README.md
22
README.md
@ -35,14 +35,6 @@ Nativefier will intelligently attempt to determine the app name, your OS and pro
|
|||||||
$ nativefier --app-name "Some Awesome App" "http://medium.com"
|
$ nativefier --app-name "Some Awesome App" "http://medium.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
Certain websites such as WhatsApp Web might say that your browser is unsupported. To get around this, simply pass in the `--pretend` flag, as such:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ nativefier --pretend "http://web.whatsapp.com"
|
|
||||||
```
|
|
||||||
|
|
||||||
This will use a preset user agent string to make the website think you're accessing it from a regular Google Chrome browser.
|
|
||||||
|
|
||||||
Other command line options are listed below.
|
Other command line options are listed below.
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
@ -136,7 +128,7 @@ There is no known way to intercept and set an event listener for a desktop notif
|
|||||||
|
|
||||||
However, this would cause issues when the command line argument `target` is set to a external page which is not a single page app, because clicking on hyperlinks and switching pages would naturally change the `document.title`. Hence, `--badge` is an optional command argument that can be set by the user if the side effect of this workaround is understood.
|
However, this would cause issues when the command line argument `target` is set to a external page which is not a single page app, because clicking on hyperlinks and switching pages would naturally change the `document.title`. Hence, `--badge` is an optional command argument that can be set by the user if the side effect of this workaround is understood.
|
||||||
|
|
||||||
#### [counter[
|
#### [counter]
|
||||||
|
|
||||||
```
|
```
|
||||||
--counter
|
--counter
|
||||||
@ -168,12 +160,14 @@ Height of the packaged application, defaults to `800px`.
|
|||||||
|
|
||||||
Set the user agent to run the created app with.
|
Set the user agent to run the created app with.
|
||||||
|
|
||||||
### [pretend]
|
### [honest]
|
||||||
```
|
|
||||||
-p, --pretend
|
|
||||||
```
|
|
||||||
|
|
||||||
Uses a preset user agent string for your OS and pretends to be a regular Google Chrome browser.
|
```
|
||||||
|
--honest
|
||||||
|
```
|
||||||
|
By default, nativefier uses a preset user agent string for your OS and masquerades as a regular Google Chrome browser, so that sites like WhatsApp Web will not say that the current browser is unsupported.
|
||||||
|
|
||||||
|
If this flag is passed, it will not override the user agent.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ function main(program) {
|
|||||||
program.width,
|
program.width,
|
||||||
program.height,
|
program.height,
|
||||||
program.userAgent,
|
program.userAgent,
|
||||||
program.pretend,
|
program.honest,
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ if (require.main === module) {
|
|||||||
.option('-w, --width <value>', 'set window width, defaults to 1280px', parseInt)
|
.option('-w, --width <value>', 'set window width, defaults to 1280px', parseInt)
|
||||||
.option('-h, --height <value>', 'set window height, defaults to 800px', parseInt)
|
.option('-h, --height <value>', 'set window height, defaults to 800px', parseInt)
|
||||||
.option('-u, --user-agent <value>', 'set the user agent string for the app')
|
.option('-u, --user-agent <value>', 'set the user agent string for the app')
|
||||||
.option('-p, --pretend', 'pretends to be a normal chrome browser')
|
.option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
if (!process.argv.slice(2).length) {
|
if (!process.argv.slice(2).length) {
|
||||||
|
@ -24,7 +24,7 @@ function optionsFactory(name,
|
|||||||
width = 1280,
|
width = 1280,
|
||||||
height = 800,
|
height = 800,
|
||||||
userAgent,
|
userAgent,
|
||||||
pretend,
|
honest = false,
|
||||||
callback) {
|
callback) {
|
||||||
|
|
||||||
targetUrl = normalizeUrl(targetUrl);
|
targetUrl = normalizeUrl(targetUrl);
|
||||||
@ -37,7 +37,7 @@ function optionsFactory(name,
|
|||||||
height = 800;
|
height = 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userAgent && pretend) {
|
if (!userAgent && !honest) {
|
||||||
userAgent = getFakeUserAgent();
|
userAgent = getFakeUserAgent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user