简体   繁体   English

在 Safari 扩展中打开没有工具栏的 Safari 窗口

[英]Open Safari window without toolbar in Safari Extension

I am trying to build macOS Safari Extension, with the ability to open a new window without toolbar, like tailwindapp.com do, in their extension.我正在尝试构建 macOS Safari 扩展,能够在他们的扩展中打开一个没有工具栏的新窗口,就像tailwindapp.com所做的那样。

If I use this function: https://developer.apple.com/documentation/safariservices/sfsafariapplication/1639493-openwindow then toolbar is visible, and I can't find any variable to hide toolbar in this method.如果我使用这个功能: https : //developer.apple.com/documentation/safariservices/sfsafariapplication/1639493-openwindow然后工具栏是可见的,我在这个方法中找不到任何隐藏工具栏的变量。

If I try to open a popup window from js, when it obviously getting blocked.如果我尝试从 js 打开一个弹出窗口,当它显然被阻止时。 So probably need to open it from the native code所以可能需要从本机代码打开它

Ok, there's no way to do it, over Safari Extension native code.好的,没有办法通过 Safari 扩展本机代码来做到这一点。 The only way to do so is through js onclick event (otherwise Safari will block popup).这样做的唯一方法是通过 js onclick 事件(否则 Safari 将阻止弹出)。 The code for js is: js的代码是:

window.open("https://yahoo.com", "title", "status=no,menubar=no,resizable=yes,width=400,height=400,top=4,left=6").focus()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Safari浏览器扩展程序中如何单击工具栏上的打开应用程序窗口? - How to open app window on toolbar click in safari app extension? 如何以编程方式打开Safari Extension ToolbarItem popover - How to open Safari Extension ToolbarItem popover programmatically 如何监听 safari 扩展弹出工具栏按钮事件 - How to listen to safari extension popup toolbar button event “退出并打开 safari 扩展首选项”按钮不起作用。 (将 Chrome 扩展转换为 Safari Web 扩展时) - "Quit and Open safari extension preferences" button not working. (While converting Chrome extension to Safari Web Extension) iOS 11 imessage扩展message.url无法打开Safari - ios 11 imessage extension message.url does not open safari 如何通过 safari web 扩展打开本地应用程序? - how to open local app through safari web extension? 从我的应用程序中的“今日扩展”(窗口小部件)打开Safari - Open Safari from my Today Extension (widget) within my app 与Safari同步 - SFSafariViewController的扩展 - Sync with Safari - extension for SFSafariViewController 如何在Safari中每个窗口的每个选项卡中获取所有打开的URL? - How to get all open URL in every tab of every Window in Safari? 在Safari中打开链接而不是uiwebview - open links in safari not uiwebview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM