Safari 扩展中的弹出窗口
我正在尝试构建我的第一个 Safari 扩展,但我对一些基本概念感到困惑。
第一个障碍是从工具栏按钮打开弹出窗口,就像 Ebay Safari 扩展一样。
Im trying to build my first safari extension and Im at a loss on a few basic concepts.
The first hurdle is making a popup window open from a toolbar button, just like the Ebay Safari extension.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
阅读此内容: http://net .tutsplus.com/tutorials/other/how-to-create-a-safari-extension-from-scratch/
它描述了按下工具栏按钮时如何发生某些事情,您只需将其放在中间即可其中:
Read this: http://net.tutsplus.com/tutorials/other/how-to-create-a-safari-extension-from-scratch/
It describes how to have something happen when a toolbar button is pressed, you would just put it the middle of this:
据我所知,Safari 不允许我们像 Chrome 那样创建“弹出窗口”。对于我的 Safari 扩展,我使用 jQueryUI 创建弹出窗口。您还可以使用 YUI 或 Mootools。在拆解 eBay 和 Twitter 扩展时,我发现他们正在使用 iframe。我不知道他们是如何实现它的,因为 jquery 不允许你修改 iframe 的内容(如果我错了,请纠正我)。
但为了回答您的问题,您的按钮将向注入的脚本发送一个事件。该脚本可以具有与此类似的代码:
这是一个非常基本的示例。我的里面有一个工具栏和许多其他东西。另外,您必须拥有非常具体的 CSS 规则,以保护您的弹出窗口的 CSS 不被世界上每个网站破坏。
我也考虑过使用 global.html 打开“弹出”窗口,但据我所知,它所能做的就是打开一个窗口。我没有看到任何用于设置尺寸等属性的工具。如果有的话,我会走这条路,因为你的弹出窗口将受到 CSS 的保护,因为它位于自己的窗口中。
As far as I know, Safari does not allow us to create a "popup" the way Chrome does. For my Safari extension I am using jQueryUI to create my popup. You can also use YUI or Mootools. In taking apart the eBay and Twitter extensions I see they're using an iframe. Just how they're implementing it I don't know since jquery doesn't allow you to modify the contents of an iframe (correct me if I'm wrong here).
But to answer your question, your button will send an event to an injected script. That script can have code similar to this:
This is a very basic example. In mine there is a toolbar, and a host of other things. Plus you have to have REALLY specific CSS rules to protect your popup's CSS from being clobbered by every site in the world.
I have also thought about using global.html to open the "popup" window but as far as I can tell, all it can do is open a window. I don't see any facilities for setting attributes like size, etc. If there are, I'd go that route since your popup would then be protected from CSS as it's in its own window.
我认为在 Safari 下它被称为弹出窗口,这就是你的意思吗?
我注意到两件事:
I think under Safari its called a popover, thats what you mean?
two things that i noticed: