docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30768)
This commit is contained in:
		
					parent
					
						
							
								7379e5eb36
							
						
					
				
			
			
				commit
				
					
						4a2f41ee58
					
				
			
		
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -143,12 +143,16 @@ browser plugins. Plugins are disabled by default.
 | 
			
		|||
### `preload`
 | 
			
		||||
 | 
			
		||||
```html
 | 
			
		||||
<!-- from a file -->
 | 
			
		||||
<webview src="https://www.github.com/" preload="./test.js"></webview>
 | 
			
		||||
<!-- or if you want to load from an asar archive -->
 | 
			
		||||
<webview src="https://www.github.com/" preload="./app.asar/test.js"></webview>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
A `String` that specifies a script that will be loaded before other scripts run in the guest
 | 
			
		||||
page. The protocol of script's URL must be either `file:` or `asar:`, because it
 | 
			
		||||
will be loaded by `require` in guest page under the hood.
 | 
			
		||||
page. The protocol of script's URL must be `file:` (even when using `asar:` archives) because
 | 
			
		||||
it will be loaded by Node's `require` under the hood, which treats `asar:` archives as virtual
 | 
			
		||||
directories.
 | 
			
		||||
 | 
			
		||||
When the guest page doesn't have node integration this script will still have
 | 
			
		||||
access to all Node APIs, but global objects injected by Node will be deleted
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue