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 directio开发者_如何学编程n?
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.
精彩评论