Skip to main content
No need for a scroll here, put it on separate lines.
Source Link
Stephen Cagle
  • 14.6k
  • 16
  • 59
  • 86

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script');  script.type = 'text/javascript';  script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0];  s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Another benefit from this technic is that you can just ignore the limitation of isolated world. see content script execution environment

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Another benefit from this technic is that you can just ignore the limitation of isolated world. see content script execution environment

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script');  script.type = 'text/javascript';  script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0];  s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Another benefit from this technic is that you can just ignore the limitation of isolated world. see content script execution environment

added 221 characters in body
Source Link
wukong
  • 2.6k
  • 2
  • 28
  • 35

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Another benefit from this technic is that you can just ignore the limitation of isolated world. see content script execution environment

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.

Another benefit from this technic is that you can just ignore the limitation of isolated world. see content script execution environment

Source Link
wukong
  • 2.6k
  • 2
  • 28
  • 35

Yes,you can do it indirectly! Here is my solution.

In manifest.json

{ "name": "", "version": "1.0.0", "description": "", "content_scripts":[{ "run_at":"document_end", "matches":["http://*/*"], "js":["/scripts/inject.js"] }] } 

In inject.js

(function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'Your_Scripts'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s); })(); 

Your injected script can inject other script from any location.