0

I have a Safari App Extension that injects a script into the host page. From that injected script, is it possible to load resources such as images or stylesheets from the main app bundle? (I mean directly, without sending messages between the two.)

zoul
  • 102,279
  • 44
  • 260
  • 354
  • Can you use a shared package for that? i.e. an assets package that is included in both the Mac app and the app extension. – quin Jul 25 '19 at 11:43

1 Answers1

0

I suppose yes. In your injected script, the path to an asset called "gigou.css" located in your extension's bundle should be accessible with safari.extension.baseURI + 'gigou.css'. Then you should be able to write dynamically a link or script tag and inject it into the document.

Greg de J
  • 320
  • 1
  • 2
  • 8