https://github.com/kreozot/webview-scripts-test
Example of unexpected injectedJavaScriptBeforeContentLoaded prop behavior
https://github.com/kreozot/webview-scripts-test
Last synced: 3 months ago
JSON representation
Example of unexpected injectedJavaScriptBeforeContentLoaded prop behavior
- Host: GitHub
- URL: https://github.com/kreozot/webview-scripts-test
- Owner: Kreozot
- Created: 2020-09-03T06:35:49.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T06:43:32.000Z (almost 5 years ago)
- Last Synced: 2025-01-28T03:18:21.499Z (4 months ago)
- Language: Java
- Size: 197 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Description
According to official docs of `react-native-webview` (The injectedJavaScriptBeforeContentLoaded prop):
> This is a script that runs before the web page loads for the first time. It only runs once, even if the page is reloaded or navigated away. This is useful if you want to inject anything into the window, localstorage, or document prior to the web code executing.
But here we can see that the script on the page runs first, and only then runs the code from the `injectedJavaScriptBeforeContentLoaded` prop.
## Expected behavior:
Alert "injectedJavaScriptBeforeContentLoaded" shows **before** "script executed".
## Actual behavior
Alert "injectedJavaScriptBeforeContentLoaded" shows **after** "script executed".