Skip to content

Commit

Permalink
docs: fix example formatting in evaluateOnNewDocument (#8906)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Sep 6, 2022
1 parent 3240095 commit 6e7c636
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/api/puppeteer.page.evaluateonnewdocument.md
Expand Up @@ -43,13 +43,13 @@ An example of overriding the navigator.languages property before the page loads:

// overwrite the `languages` property to use a custom getter
Object.defineProperty(navigator, 'languages', {
get: function () {
return ['en-US', 'en', 'bn'];
},
get: function () {
return ['en-US', 'en', 'bn'];
},
});

// In your puppeteer script, assuming the preload.js file is
in same folder of our script
// in same folder of our script.
const preloadFile = fs.readFileSync('./preload.js', 'utf8');
await page.evaluateOnNewDocument(preloadFile);
```
8 changes: 4 additions & 4 deletions src/common/Page.ts
Expand Up @@ -2784,13 +2784,13 @@ export class Page extends EventEmitter {
*
* // overwrite the `languages` property to use a custom getter
* Object.defineProperty(navigator, 'languages', {
* get: function () {
* return ['en-US', 'en', 'bn'];
* },
* get: function () {
* return ['en-US', 'en', 'bn'];
* },
* });
*
* // In your puppeteer script, assuming the preload.js file is
* in same folder of our script
* // in same folder of our script.
* const preloadFile = fs.readFileSync('./preload.js', 'utf8');
* await page.evaluateOnNewDocument(preloadFile);
* ```
Expand Down

0 comments on commit 6e7c636

Please sign in to comment.