|// this is the code which will be injected into a given page...|
|// just place a div at top right|
|var div = document.createElement('div');|
|div.style.position = 'fixed';|
|div.style.top = 0;|
|div.style.right = 0;|
|div.textContent = 'Injected!';|
|alert('inserted self... giggity');|
|"description": "Injecting stuff",|
thanks for this. I have a problem. I want to take info at website. I changed this application.
Function writes t3 on console. but don't return t3 variable. console.log(result) writes 'null' ;
what is the problem this code ?
thaks good job
Shouldn't be there:
tab.id instead of tab.ib ?
In this case tab.ib is null, so:
is there a way to run/execute a Chrome Extension in a new tab/window by loading the extension's code in that new tab or window?
Thank you .
Danharper thanks for the idiomatic kit for getting things going.
I plunged into extension stuff, as I was getting tired of High Contrast Chrome extension not working, or only working sporadically.
If you have any tips on how to make gmail display all its views/texts white on black background it would be a great head start for me.
Thanks in advance.
Hey, I'm a java noob and i'm trying to inject a script onto a live page. If anyone here can help me out just a little that would be great! PM me at twokeywood -skype or firstname.lastname@example.org
@brettsprad Yes you can. Just create a new script element, add it to the document and then set the src to your url
Something like this:
@dunklesToast I have tried your suggested method but failed to execute the script of injected file.
In this approach .js file injected but script of that file could not access/run.
In both 2nd and 3rd approaches file not injected.
According to the docs, if the goal is to inject scripts into tabs, I think declarative injection is the simplest solution. In the manifest, add
The above injects myJsFile.js into every tab opened in the browser.
How would you remove the div by clicking the extension icon?
This method has worked great for adding a fixed menu div on top of a webpage but it would be awesome if I could delete/remove what I added and reset the page to the way it was. All without refreshing the page of course.
I figured making these changes to the background script and adding an ID to my div for deletion would work but the code doesn't seem to find the div. So I can't remove the div I added.
If you add this to your commands section in manifest.json
You can open the browser action with a keyboard command, which will trigger the onClick event