Skip to content

Commit 4c05ff0

Browse files
committed
[docs] executeScript in main world of webview
Ref nwjs#6299 nwjs#6229
1 parent 85a786f commit 4c05ff0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/References/webview Tag.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ and add 'partition="trusted"' attribute to the webview tag.
4444

4545
To enable Node.js support in WebView, add the `allownw` attribute to the webview tag. Then Node.js will be turned on, no matter it loads local file or remote site. Use this feature with caution because webview is normally supposed to load untrusted contents.
4646

47+
### executeScript in main world
48+
49+
The [executeScript function in Chrome](https://developer.chrome.com/apps/tags/webview#method-executeScript) lets you inject JS code into webview, but in a isolated world. To access JS objects in the target DOM context, you can inject code into the main world context instead. Simply adding `{mainWorld: true}` to `InjectDetails` typed parameter of the function.
50+
4751
### Cookies support in webview
4852

4953
Webview has 'getCookieStoreId()' function which returns storeId which can be used in [chrome.cookies](https://developer.chrome.com/extensions/cookies) API.

0 commit comments

Comments
 (0)