mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: add note about Service Workers and route (#8401)
This commit is contained in:
parent
5814a4aab8
commit
d52250f2c5
@ -854,6 +854,10 @@ Returns all open pages in the context.
|
||||
Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
||||
is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
||||
|
||||
:::note
|
||||
[`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
|
||||
:::
|
||||
|
||||
An example of a naive handler that aborts all image requests:
|
||||
|
||||
```js
|
||||
|
||||
@ -2410,6 +2410,10 @@ Once routing is enabled, every request matching the url pattern will stall unles
|
||||
The handler will only be called for the first url if the response is a redirect.
|
||||
:::
|
||||
|
||||
:::note
|
||||
[`method: Page.route`] will not intercept requests intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete window.navigator.serviceWorker);`
|
||||
:::
|
||||
|
||||
An example of a naive handler that aborts all image requests:
|
||||
|
||||
```js
|
||||
|
||||
9
types/types.d.ts
vendored
9
types/types.d.ts
vendored
@ -2339,6 +2339,10 @@ export interface Page {
|
||||
* Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
||||
*
|
||||
* > NOTE: The handler will only be called for the first url if the response is a redirect.
|
||||
* > NOTE: [page.route(url, handler)](https://playwright.dev/docs/api/class-page#page-route) will not intercept requests
|
||||
* intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend
|
||||
* disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete
|
||||
* window.navigator.serviceWorker);`
|
||||
*
|
||||
* An example of a naive handler that aborts all image requests:
|
||||
*
|
||||
@ -5496,6 +5500,11 @@ export interface BrowserContext {
|
||||
* Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
|
||||
* is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
|
||||
*
|
||||
* > NOTE: [page.route(url, handler)](https://playwright.dev/docs/api/class-page#page-route) will not intercept requests
|
||||
* intercepted by Service Worker. See [this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend
|
||||
* disabling Service Workers when using request interception. Via `await context.addInitScript(() => delete
|
||||
* window.navigator.serviceWorker);`
|
||||
*
|
||||
* An example of a naive handler that aborts all image requests:
|
||||
*
|
||||
* ```js
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user