打开指定宽度和宽度的窗口高度

发布于 2024-09-12 16:03:02 字数 775 浏览 3 评论 0 原文

我正在开发一个 safari 扩展,一旦单击按钮,我需要创建一个弹出窗口,我尝试使用 iframe 进行覆盖,但是目标重定向整个页面,因此我被迫使用弹出窗口。

“window.open() JavaScript 方法不能用于从全局 HTML 文件或扩展栏打开新选项卡和窗口。相反,全局文件和扩展栏可以访问 SafariApplication、SafariBrowserWindow 和 SafariBrowserTab 类,其方法和属性允许您使用窗口和选项卡。” (https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html#//apple_ref/doc/uid/TP40009977-CH17

您可以使用safari.application.openBrowserWindow() 打开一个窗口,但我无法找到指定窗口的 URL 或高度/宽度的文档。

有人能指出我正确的方向吗?

I am developing a safari extension and I need to create a popup once you click on a button, I tried an overlay with an iframe but, the destination redirects the whole page so I am forced to use a popup.

"window.open() JavaScript method cannot be used to open a new tab and widow from a global HTML file or an extension bar. Instead, the global file and extension bars have access to the SafariApplication, SafariBrowserWindow, and SafariBrowserTab classes, whose methods and properties allow you to work with windows and tabs." (https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html#//apple_ref/doc/uid/TP40009977-CH17)

You can use safari.application.openBrowserWindow() to open a window but I haven't been able to find the documentation to specify a URL or height/width of the window.

Could someone point me in the right direction?

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

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

发布评论

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

评论(1

顾铮苏瑾 2024-09-19 16:03:02

我快速浏览了一下 Safari 扩展参考,看起来当您调用 openBrowserWindow 时,您会获得对 SafariBrowserWindow 的引用,该 SafariBrowserWindow 有一个 activeTab 属性,可以为您提供 SafariBrowserTab 引用。 SafariBrowserTab 有一个 url 属性,您可以使用它来指定要加载的 url。

I took a quick look through the Safari Extensions Reference and it looks like when you call openBrowserWindow you get a reference to a SafariBrowserWindow which has an activeTab property that gets you a SafariBrowserTab reference. SafariBrowserTab has a url property that you can use to specify the url you want to load.

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