Safari 扩展可以对新选项卡的创建做出反应吗?

发布于 2024-09-10 23:53:00 字数 170 浏览 2 评论 0原文

我目前正在为 Safari 5 编写第一个扩展。我找不到有关扩展可以响应哪些事件的参考。

我希望我的扩展能够对这些事件做出反应:

  • 创建新选项卡时。
  • 当创建新的浏览器窗口时。
  • 当选项卡内的 URL 更改时。

这可能吗?

I am currently writing my first extension for Safari 5. I can't find a reference on what events an extension can react.

I want my extension to react on these events:

  • when a new tab is created.
  • when a new browser window is created.
  • when the URL inside a tab changes.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

内心荒芜 2024-09-17 23:53:00

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.

眉目亦如画i 2024-09-17 23:53:00

是的,从版本 5.1 开始,

来自 Safari 文档

在 Safari 5.1 及更高版本中,您可以监听并响应
以下窗口和选项卡事件:

打开 - Safari 在窗口或选项卡首次出现时向其发送“打开”事件
打开。

...

导航 - 当新 URL 的主框架加载后,Safari 会向选项卡发送“导航”事件。

Yes, as of version 5.1

From the Safari documentation:

In Safari 5.1 and later, you can listen for and respond to the
following window and tab events:

Open—Safari sends an "open" event to a window or tab when it is first
opened.

...

Navigate—Safari sends a "navigate" event to a tab when the main frame of the new URL has loaded.

你怎么这么可爱啊 2024-09-17 23:53:00

这是参考: Windows 和选项卡 API

编辑: 嗯...它似乎只记录了如何执行某些操作,而不记录如何侦听事件:- /

Here is the reference: The Windows and Tabs API

Edit: Hmm... it seems it only documents how to do some actions, not how to listen to events :-/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文