[英]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.