Safari扩展运行多次注入javascript
作者:互联网
我已经在Apple Developer站点上复制了以下示例中的代码.
当我运行扩展时,它会正常运行,除了注入的脚本运行3次,导致输出被写入console.log 3次.我还在doBigCalc函数中发出警报,它打开了3个警报.
为什么会发生/它应该发生?
解决方法:
您没有说明您的实现,但可能是您的代码不是问题.关键是要了解注入的脚本已加载….从injected script documentation:
Scripts are injected into the top-level page and any children with HTML sources, such as iframes. Do not assume that there is only one instance of your script per browser tab.
标签:safari-extension,javascript,safari 来源: https://codeday.me/bug/20190827/1740150.html