mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 02:28:55 +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"
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
#### [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.
|
||||
|
||||
### [pretend]
|
||||
```
|
||||
-p, --pretend
|
||||
```
|
||||
### [honest]
|
||||
|
||||
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
|
||||
|
||||
|
@ -28,7 +28,7 @@ function main(program) {
|
||||
program.width,
|
||||
program.height,
|
||||
program.userAgent,
|
||||
program.pretend,
|
||||
program.honest,
|
||||
callback);
|
||||
},
|
||||
|
||||
@ -65,7 +65,7 @@ if (require.main === module) {
|
||||
.option('-w, --width <value>', 'set window width, defaults to 1280px', 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('-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);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
|
@ -24,7 +24,7 @@ function optionsFactory(name,
|
||||
width = 1280,
|
||||
height = 800,
|
||||
userAgent,
|
||||
pretend,
|
||||
honest = false,
|
||||
callback) {
|
||||
|
||||
targetUrl = normalizeUrl(targetUrl);
|
||||
@ -37,7 +37,7 @@ function optionsFactory(name,
|
||||
height = 800;
|
||||
}
|
||||
|
||||
if (!userAgent && pretend) {
|
||||
if (!userAgent && !honest) {
|
||||
userAgent = getFakeUserAgent();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user