mozilla firefox extension: creating a javascript library and using it in a HTML page -
mozilla firefox extension: creating a javascript library and using it in a HTML page -
i created library in firefox extension :
./components/main.js ./skin/icon.png ./install.rdf ./chrome.manifest
my main.js utilize define class calling mozilla tcpscoket ( https://developer.mozilla.org/en-us/docs/web/api/tcpsocket)
function mylib() {} mylib.prototype.dowork = function(arg1,arg2) { /* tcpscoket */}
how should utilize library on client side in html ?
i'm looking (?):
<html><head><script> var mylib = mozillaapithing.createnewinstance("chrome://myextension/", "mylib"); .... </script>(...)
chrome
or resource
(not in restartless) urls available direct urls (ie can come in them address-bar , show up). hence can utilize simple script src
<script src="chrome://myextension/components/jsfile.js"></script>
alternatively, can read js file (ie xmlhttprequest or fileutils.jsm or osfile.jsm) , insert content page createelement('script')
, textcontent
, appendchild()
alternatively, can seek the message manager
note: inserted local script page have content page scope (no access browser scope api)
javascript firefox firefox-addon
Comments
Post a Comment