I'm trying to build a simple safari app extension. On about:blank
I load a html page from resources folder of extension. Following is the code for that.
//script.js - injected script
if(window.location.href=="about:blank"){
window.location.href = safari.extension.baseURI + "page.html";
}
I want communication between this loaded page and safari app. Apparently injected script script.js
is not available on loaded html page.
I tried linking the script.js
to html page inline but the safari
object itself is not available for safari.extension.dispatchMessage
or safari.self.addEventListener
.
EDIT:
with this ( injected script script.js is not available on loaded html page/tab the page is loaded in) I mean that on opening web inspector in resources tab we can't see any extension scripts