safari-extension

Safari 5 Extension: How can I detect when a window's current tab has changed?

限于喜欢 提交于 2019-12-18 17:56:20
问题 I have a Safari 5 extension that contains a toolbar. Whenever the current tab changes, that toolbar should be updated. I would like to do something like this from my bar's script: safari.self.browserWindow.addEventListener("activeTab", tabChanged, false); However, that doesn't seem to work. I have tried a number of other event names as well: activeTab activeTabChanged onActiveTab onActiveTabChanged tab tabChanged onTab onTabChanged selectionChanged onSelectionChanged Does anybody know how to

Safari Extension Companion is always null

烈酒焚心 提交于 2019-12-18 15:09:51
问题 I am developing a Safari Extension for my local Mac App, I want to use SafariExtension Companion to communicate between them. However, in my Global.html of the extension, whenever I am trying to get safari.extension.companion, it is always null. Do I setup the extension wrong? Besides, according to the guide, I can use safari.extension.addEventListener to listen the message from local app, however, when I debug the extension, it prompts me safari.extension.addEventListener is undefined, why

Highlight URL bar using Chrome and Safari extension

与世无争的帅哥 提交于 2019-12-17 20:49:17
问题 Is it possible to highlight the URL bar (set focus to the location bar) using Google Chrome extensions or Safari extensions? Using Firefox extensions, one can highlight the URL bar like this: var addressBar=document.getElementById('urlbar'); addressBar.focus(); addressBar.select(); I'm not sure if there's similar functionality in Chrome and Safari. Thanks in advance for your help! 回答1: Firefox, in its plugins and extensions gives access to browser's "chrome" (the UI stuff around the page)

safari extension beforeload event documentation

╄→гoц情女王★ 提交于 2019-12-17 20:39:07
问题 I can't find any documentation on the "beforeload" event other than the Blocking Unwanted Content section of this. What I'm specifically looking for is the event message structure. From the above doc I know that there is a "event.url" member, but not much else. From a snip of source code I know there's also a "event.target.nodeName" member. But I don't have anything more than that. I got lost in both the WebKit docs and w3 event docs. Where can I find some simple reference documentation for

One Click install for Safari Extensions

∥☆過路亽.° 提交于 2019-12-13 13:30:40
问题 When a user downloads a plugin firefox (for example) the plugin installation begins as soon as the download has completed. Is it possible to achieve the same thing in safari? i.e. user clicks link to download plugin, once it has downloaded it automatically begins the installation. 回答1: I don't think this is possible to do on any other domain except extensions.apple.com . I've done some extensive testing on this and the safari.installExtension() method is only present if the domain matches

safari extension to obtain url from address bar

北城以北 提交于 2019-12-13 05:25:52
问题 I am working on a Safari Extension to obtain the url from the address bar and then send it to a mysql database. This in turn is picked by a website that displays the database content. The part where I am stuck at is how do I obtain the URL from the address bar from within a Safari Extension ? I am using php to then update the database with the url once I get it. Thanks in advance. 回答1: This solved my issue. var myurl = safari.application.activeBrowserWindow.activeTab.url; 回答2: with javascript

HTTPS page was not allowed to run insecure content from safari-extension:// URI

心已入冬 提交于 2019-12-12 13:23:43
问题 I face a strange behavior in a Safari extension with Safari 9.1 (11601.5.17.1). I try to insert a new Iframe with an src pointing to an html file in the extension package using "safari-extension://...". The URL is correct and the content is displayed in a new tab, if I click on the link from the error message displayed in the console. [blocked] The page at https:// was not allowed to run insecure content from safari-extension://com.mycompany.myextension-7KZE138RQQ/3d4c3273/js/proxy.js. It

Get URL and page title data from SafariNavigateEvent

 ̄綄美尐妖づ 提交于 2019-12-12 09:47:25
问题 I am debugging something for a colleague who is on holiday and know very little about Safari Extension development. I have a Safari extension that listens for 'open', 'beforeNavigate', 'navigate' and 'activate' events. When any of these events are fired I want to track the activeTab's url and page title. It seems however that in certain instances (namely beforeNavigate and navigate when a new tab is opened) the page title isn't always defined in either the safari.application

How to intercept a web request

假如想象 提交于 2019-12-12 08:01:58
问题 Is there something like Chromium's chrome.webRequest for Safari extensions? I went through their documentation here. The closest thing I could find was SafariBeforeNavigateEvent. This will prevent the new page load but still would send the request to the server. Moreover I don't think it will call the listeners on AJAX requests. Anyone tried something similar? 回答1: We solved this problem by using "xmlhttprequest" overriding. This is our content.js . We injected content.js as start script $

How to store object as key in a array using javascript [duplicate]

馋奶兔 提交于 2019-12-12 01:24:20
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to store objects in a array using javascript i want to store object as key in a array what is the solution. var myTabObj = safari.application.activeBrowserWindow.activeTab; I want to store myTabObj as key in a array. I think myTabObj is unique for safari browser tab specific. OR How to set tab specific values in safari extension development. I want solution immidiately please help me. for example i have 3