According to the doc from apple(https://developer.apple.com/documentation/safariservices/safari_app_extensions/injecting_a_script_into_a_webpage?changes=l_3&language=objc), the js thow exception as follows:
function run() {
var newElement = document.createElement("img");
newElement.src = safari.extension.baseURI + "bb.png";
document.body.insertBefore(newElement,
document.body.firstChild);
}
if(document.readyState !== 'loading') {
run();
} else {
document.addEventListener("DOMContentLoaded", function(e){
run();
});
}
the error message is : Can't find variable: safari
what should I do?