Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing local resources from a content script

Is there a way i can access local resources inside a script? I need to access data.url('layout.html'), data.url('icon.png') and data.url('style.css') inside the contentScript handler.

exports.main = function() {
  require("widget").Widget({
    onClick: function() {
      tabs.activeTab.attach({
        contentScriptFile: [ data.url('jquery.js')],
        contentScript:
          "setTimeout(function(){ alert('asd');}, 100);",
        });
    } 
  });
}
like image 779
Quamis Avatar asked Jul 13 '26 13:07

Quamis


1 Answers

I've ended up using cssUrl = data.url('alert.css'). In main.js i set this up, and in the script running client-side add a script having href=cssUrl.

like image 50
Quamis Avatar answered Jul 17 '26 23:07

Quamis