Skip to content

nonowarn/content-script-with-requirejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This demostration extends require.js to use the library in chrome's content scripts by monkeypatching.

This code is once posted in the require.js' forum. The original require.js implementation of script loading is inserting <script> to the document and handling load event. But chrome isolates the script execution context in tabs from content scripts. Although content scripts is injected into the tab's context, module files are loaded into extension's context. This monkeypatch fixes them by loading modules to tab's context by XHR to the extension's URL and evaling the response.

Licensed under Apache License, Version 2.0.

About

This is demonstration for how to use require.js in content scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published