[英]Can a Safari Extension react on the creation of a new tab?
I am currently writing my first extension for Safari 5. I can't find a reference on what events an extension can react. 我目前正在为Safari 5编写第一个扩展程序。我无法找到扩展可以响应的事件的参考。
I want my extension to react on these events: 我希望我的扩展程序对这些事件作出反应:
Is this possible? 这可能吗?
Yes. 是。 Create an Injected Script and add it as an End Script. 创建注入脚本并将其添加为结束脚本。 Set the Access Level of Extension Website Access in the builder to All. 将构建器中的扩展站点访问的访问级别设置为全部。 Your Injected End Script will be called for every page that loads in Safari, which covers all of the cases you mentioned. 您将在Safari中加载的每个页面调用您的注入结束脚本,其中包含您提到的所有案例。
From the Safari documentation : 从Safari文档 :
In Safari 5.1 and later, you can listen for and respond to the following window and tab events: 在Safari 5.1及更高版本中,您可以侦听并响应以下窗口和选项卡事件:
Open—Safari sends an "open" event to a window or tab when it is first opened. Open-Safari在首次打开时向窗口或选项卡发送“打开”事件。
... ...
Navigate—Safari sends a "navigate" event to a tab when the main frame of the new URL has loaded. 当加载新URL的主框架时,Navigate-Safari会向选项卡发送“导航”事件。
Here is the reference: The Windows and Tabs API 以下是参考: Windows和Tabs API
Edit: Hmm... it seems it only documents how to do some actions, not how to listen to events :-/ 编辑:嗯......似乎它只记录如何做一些动作,而不是如何听事件: - /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.