Content-scripts are not injected correctly
See original GitHub issueNWJS Version: 0.49.x, 0.50.x Operating System: Win 10
Expected behavior
Insert content-scripts correctly, works fine in NWjs 0.47.3 and NWjs 0.48.4
Actual behavior
Sometimes, after init/load webview and injection content-scripts (via webview.addContentScripts
).
How to reproduce
- Example.zip
- contentscript.js - injected to webview, easy example for chrome.runtime communictaion, example showing command message
hello-world
from webview to window.connection.command('hello-world', null, (returnData) => console.log(returnData));
- window2.js - chrome.runtime.onMessage, return to webview ‘Hi!’, if receive
hello-word
message.
- contentscript.js - injected to webview, easy example for chrome.runtime communictaion, example showing command message
- Run with NWjs, check devtools (shown automatically)
- Some startup, incialized wrong, missing contentscript.js
- Some startup, incialized ok
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:29 (10 by maintainers)
Top Results From Across the Web
Chrome extension content scripts are not injected in the first ...
After reloading the page all scripts are injected correctly, and my extension works as expected. What can be the reason for that, and...
Read more >Content scripts do not inject into frames with no src ... - Monorail
Issue 76429: Content scripts do not inject into frames with no src because their url is "about:blank" · 1. create an extension with...
Read more >Content Scripts - Google Chrome Extensions
The content script will be injected into a page if its URL matches any matches pattern and any include_globs pattern, as long as...
Read more >Injecting a script tag from a content script to an iframe with ...
I'm working on an extension that injects a piece of code into iframes. I'm using manifest v3 and I have a content script...
Read more >Chrome Extension Tutorial: How to Pass Messages from a ...
Content Scripts have easy access to the DOM of the web page. We make use of the content script to append our custom...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually @TheJaredWilcurt, I have tested it a bit more (on macOS) and indeed when I reload the window (that is, Ctrl+R in the devtools window) rather than quit & relaunch, the
generated_script_file
(the one that holdsparams
) is missing about one out of three times.When quitting & relaunching, it is always there.
@corwin-of-amber Thanks for suggest, but it still is not fixed.
or sometimes
I hate these random issues.