Converting my own Chrome/Firefox extension to mxaddon


B1RD

Recommended Posts

Any one out there that can give me some pointers I have an extension that I wrote that works in both Firefox and Chrome. I'm trying to port the Chrome version to a mxaddon. But I run into a problem when I try to pass urls of scripts or images from inside the extension to the page using mx.app.runtime.getPrivateUrl().

Basic layout of folder is this:

icons

img

js

def.json

script.js

in script.js have following lines of code that does not work.var mxRuntime=window.external.mxGetRuntime();

var strHtml= 'var CssUrl = "'+mxRuntime.getPrivateUrl()+'js/MNBassistant.css", ZooItemJsUrl = "'+mxRuntime.getPrivateUrl()+'js/zooItem.js", TranslationJsUrl = "'+mxRuntime.getPrivateUrl()+'js/MNBassistantLanguages2.22.js", TranslationBaseJsUrl = "'+mxRuntime.getPrivateUrl()+'js/english_base2.21.js", ExtUrl = "'+mxRuntime.getPrivateUrl()+'";', mmzwZooAssistantJsUrl = mxRuntime.getPrivateUrl()+'js/MNBassistantMain1.0.js', assetsLoaded=false;This passes the url fine, but the page responds (not allowed to load local resource: mxaddon-pkg://{B21576EE-AEF9-49A4-AAE6-814C7ABD14F4}/js/MNBassistantMain1.0.js)

But I can paste url in location bar and it displays the script source.

Can I pass these another way?

Is there another key in def.json to set these files as accessible from the page similar to web_accessible_resources?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.