Questions tagged [safari-extension]

Safari Extensions are a way to develop and distribute additional functionality for Apple's Safari web browser. As of Safari 10 and MacOS 10.12 ("Sierra"), the Safari Extension API has been deprecated in favour of a new API named Safari App Extensions.

0
votes
0answers
14 views

How to prevent multiple injection of content script when disabling/re-enabling safari extension?

If Safari, I end up with multiple copies of the content script being injected if I disable and then re-enable the extension in the same session. After page refresh, things return to normal. Chrome ...
3
votes
0answers
27 views

Can you still distribute legacy safari extensions?

I have a legacy safari extension. I understand that I will not be able to distribute it through the Mac App Store. On the apple developer website it says it is possible to notarize the app and ...
1
vote
0answers
51 views

Sharing cookies between background page and Safari in new-way extensions

Trying to update my old-styled Safari extension with background HTML page according to native app extension. The extension should perform HTTP requests in a background mode, and the earlier version ...
0
votes
0answers
19 views

Create a safari extension to download a file

I would like to create a simple safari extension to download an image file. There are already the commands "Save image as ..." but my goal is to format the file name just before the download in the ...
0
votes
0answers
15 views

How to get image data from the context menu in Safari Extension

I have a Safari Extension and have gotten the context menu to work. I had few queries to be addressed. I have added the listener script.js like this document.addEventListener("contextmenu", ...
0
votes
1answer
39 views

Open Safari window without toolbar

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. If I use this function: https://developer.apple.com/...
0
votes
0answers
19 views

Use siri to open specific site on safari

I want to open my website on safari, whenever user will ask Show My data MYSITE, Show report MISITE so it will open the website and show the content. I have create application and mac app, But not ...
-5
votes
1answer
111 views

Safari App Extension to read browser history

Can the new Safari App Extensions read browser history? If so, what are the API calls?
1
vote
0answers
29 views

Open new tab after Safari App Extension is enabled

I'm looking for a way to watch state of extension and open a new tab automatically, once it is enabled. Previously I was relying on a `SFSafariExtensionManager.getStateOfSafariExtension, but it has ...
0
votes
1answer
49 views

Safari extension's content CSS priority issue

I found a problem with how Safari prioritises CSS between the css included with the HTML page and the injected content CSS. I created a minimal reproducible showcase and uploaded it to GitHub. The ...
0
votes
0answers
41 views

Why does nothing happen, after I enable the Safari Content Blocker?

After failing to get the content blocker to work with several rules, I just activated a rule to block all connections: [ { "trigger": { "url-filter": ".*", }, "...
0
votes
1answer
52 views

Accessing Current Page Information in Safari 12 Extension Popover

I'm trying to get the active tab's page information to be displayed in a popover. I'm able to get it to show the URL or Title of the page currently, but it requires opening and closing the extension ...
0
votes
0answers
28 views

What is wrong with this Safari Blocker Regex?

I am developing a Safari extension (https://github.com/bcye/Hello-Goodbye in Safari folder) and am trying to block chat widgets. I tried to block (in Chrome extension syntax) *://widget.intercom.io/* ...
0
votes
0answers
18 views

Override new tab page in Safari with extension

I've researched the possibility of building an extension that replaces the new tab page. I found this answer which seems to say it is not possible. I can't find anything in Apple's docs stating if it'...
0
votes
0answers
14 views

Safari extension build package keychain login not working

I'm building a Safari content blocker extension. I've already created the .json file and have it chosen in the 'Content Blocker File' dropdown. It correctly shows the Safari Developer cert up top. ...
1
vote
3answers
31 views

JavaScript: Understanding [match] principle

New to coding. I don't understand the principle of [match]. I mean; var wikipediaDontRedirectRegExp = new RegExp("^https?://([a-zA-Z0-9\\-_]+)\\.(?:m\\.)?wikipedia\\.(?:com|org)/wiki/(.*)(?:\\?...
0
votes
0answers
13 views

How to maintain JavaScript object context in a Safari extension call?

I'm writing a safari extension and when I use an anonymous function callback to the extension get request I lose the context of the calling module. Does anyone know of a way to maintain the context ...
0
votes
0answers
26 views

Cannot access Safari Extension APIs through my extension

I am trying to add my own key-value to the safari settings API through my safari extension. It seems to work in my safari browser but doesn't work in my friend's Mac(I am able to access the API but ...
1
vote
1answer
56 views

Safari Extension Fails to perform URLSession Tasks with error: failed path:/var/run/mDNSResponder Operation not permitted

Hi guys I attempts to make RESTful call when toolbar item is click. then it fails to connect to the internet with the following error in log. [default] Unable to load Info.plist exceptions (...
0
votes
0answers
23 views

Getting tab url, cookies from safari extension popup, content script

I need authorize user in my safari extension popup, but safari doesnt send cookies in ajax, so how can i get cookies in popup? document.cookie isnt working And i need get url of tab in popup and ...
0
votes
1answer
132 views

Copy window.location.href to clipboard from extension

I am trying to copy 'window.location.href' e.g. the URL of the current page to clipboard from my extension. My issue is that when I copy the URL to clipboard, it is the extensions URL that is copied ...
1
vote
2answers
48 views

Listbox selected item button click open link from value

I am trying to create an extension for Safari browser that will add a bar(.html) with a listbox of several links and a button. When I click on the button the selected item (e.g. link) from the listbox ...
0
votes
2answers
266 views

How to open new tab with Button click in Safari with extension?

I am having issues opening a new tab in Safari browser with my extension. Using the Extension Builder I added bar.html: <html> <body> <form id="myForm"> <input type="button"...
1
vote
2answers
229 views

How can I develop Safari App Extension without macOS app?

I've just developed a brand new Safari App Extension. I do not have any mac os app to share through the mac app store, only my extension THAT IS my product. It seems (from that Apple page) that I ...
0
votes
0answers
18 views

Safari extension how to pass message from global page to current webpage

I am trying to create a safari extension that allows user to right click on the context menu then start to execute some injected javascript function on the user's current web page. Now I can get the ...
0
votes
0answers
8 views

Extention becomes unavailable in safari after changes to template

I'm trying to go through the tutorial for creating a safari extension here https://developer.apple.com/documentation/safariservices/safari_app_extensions When I create a new project from the template ...
0
votes
0answers
50 views

Add element to website/tab from Safari extension

I am trying to create an extension for Safari that will add an element to the page/tab that I am currently on. In the example below I'd like to add the Send button to the page. The issue for me is ...
0
votes
0answers
46 views

How I can get url in safari extension when safari start loading page

func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) { page.getPropertiesWithCompletionHandler { properties in } } This function is ...
0
votes
0answers
20 views

Xcode extension programing safari storing details

Is there a way to store username and password into an safari extension, I have done it in Firefox and chrome using local storage and an option page but can't find anything like this in safari, does ...
0
votes
0answers
19 views

Safari Xcode Inject.js

I am developing a safari extension in xcode injection js I am having trouble adding note to existing one, I have tried serveral ways but don't seem to work e.g. Elm = createElement("a"); Elm2 = ...
0
votes
0answers
55 views

Unable to install Dashlane's Safari extension on MacBook Pro

I recently installed the Safari 12.0.1 update on my MacBook. When I restarted the laptop I noticed all my Safari extensions were gone. The only one I really used was Dashlane for auto logins of ...
1
vote
0answers
116 views

How to add whitelisted domains when using Safari Content blocker in the iPhone

What's the proper way to create whitelists when using Safari content blocker API? https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ContentBlocker.html ...
0
votes
1answer
14 views

During our review of your extension we found that the Info.plist is missing the ‘Website' field while submitting to safari extension gallery

While submitting the safari extension in Safari extension gallery I am getting the query of During our review of your extension we found that the Info.plist is missing the ‘Website' field. URL is ...
0
votes
1answer
162 views

Closing a Tab from a Safari App Extension

I am having a surprisingly hard time finding a way to close a tab from a Safari App Extension. I can open a tab with SFSafariApplication.getActiveWindow(completionHandler: { $0?.openTab(with: ...
1
vote
1answer
209 views

Load popover programmatically in Safari App Extension

I currently implement a Safari App Extension, which I want to have the ability to show the extension's popover using a keyboard shortcut. Using the old Safari Extension API, this was done by using ...
1
vote
1answer
184 views

Safari extension builded with Xcode, disappears from Safari after rebuild

I'm trying to build a Safari extension using Xcode, using this manual: https://developer.apple.com/documentation/safariservices/safari_app_extensions/building_a_safari_app_extension The first time it ...
0
votes
0answers
71 views

Safari 12 extension performance warning

I have an extension listed in safari extension gallery. After Safari 12 update the extension was marked as slow and was disabled by default. According to the release notes (https://developer.apple.com/...
0
votes
0answers
44 views

safari.extension.settings is not a object?

I'm constantly getting this error, in attempt to do JavaScript code in my Safari Extension. (I'm trying to make a light version of my Chrome Extension for Safari...) One thing I'm trying to do, is an ...
0
votes
1answer
250 views

Safari 12 Extensions and NativeMessaging

With the release of Safari 12, Safari will no longer support NPAPI plugins. My use case is to be able to launch a java application located on a client from a browser extension which I can currently do ...
6
votes
4answers
1k views

Convert Web Extension to Safari App Extension

I have Web Extensions which currently runs on Chrome, Firefox and Opera. Now I'm wondering is there a way to use same code to build Safari App Extension, maybe something like PhoneGap(wrap all ...
2
votes
2answers
805 views

A fix/workaround for unsupported Safari Extensions in Safari 12?

The latest Safari update (12.0, Sept 17, 2018) turns off some and and stops supporting other extensions. E.g., many people use Pocket's Safari Extension to save items to a OS-independent list. But I ...
2
votes
1answer
246 views

How to listen to “beforeNavigate” event in safari app extensions

I'm developing a safari app extension. I've to listen to "beforeNavigate" event as in old Safari JS Extensions, we could listen to these events using Safari's Windows & Tabs API. I went through ...
0
votes
1answer
92 views

not running on AppKit (main) thread issue when navigating to another xib

The use case of my application is there is a login ui which is handled in SafariExtensionViewController.xib and when the user hits the login button another UI has to be shown and that is ...
0
votes
1answer
58 views

save email to safari local storage after login success

I am trying to develop safari extension using swift safari services. The project is created from mac os and then safari extension. I am javascript developer but developing safari extension needed to ...
0
votes
0answers
61 views

how to get postition of safari toolbar download button in safari app extension

I want to point an arrow to download button of safari toolbar after one downloads my app extension like below but the download button seem to change the position when window size is reduced. how to ...
1
vote
0answers
38 views

OS X Background Fetch Equivalent

I'm familiar with the Background Fetch in UIKit but I was wondering if there is an equivalent for OS X apps. My application is bundled with a Safari App Extension that needs to update frequently. ...
1
vote
0answers
70 views

Safari extension publish process

I see a big difference with publishing/updating a browser extension in Safari compared to Chrome/Firefox. Particularly I have 3 questions: Does safari gallery have a developer's dashboard to manage/...
0
votes
0answers
36 views

Safari extension builder is modifying my info.plist on load

I am working on a legacy safari extension. I have added some features to it. Now for testing purposes when i load my extension folder to Safari Extension Builder I notice that it modifies my info....
7
votes
2answers
1k views

How can crashes of Safari extensions on Mojave be avoided?

When I build my macOS application that has an Safari extension in it, which I run on Safari, it crashes after a couple of seconds of running (though it does show up in the extensions). It seems to be ...
-1
votes
1answer
57 views

how do I implement content security policy in safari extension

I am getting following error Refused to load https://plus.google.com/_/favicon?domain_url=https://idmsa.apple.com/appleauth/auth/signin?widgetKey=83545bf919730e51dbfba24e7e8a78d2&locale=en_US&...