Post

Replies

Boosts

Views

Activity

Can't find variable: safari ?
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?
1
0
2.0k
Oct ’21