Post not yet marked as solved
I'm trying to load JSON from somewhere other than my bundle, but it's not working. I can't get debugger breakpoints to work, print() doesn't work (swift), even NSLog doesn't work (doesn't even go to Console).Is there any way to be able to debug the ActionRequestHandler in the extension?
Post not yet marked as solved
I'm having trouble finding info on the reasoning, timing, and info on the transition from the old way of creating a Safari Extension to the new Safari App Extensions. I'm curious if someone could point me to an official post about this or post it here? My main questions are:Are Safari Extensions officially deprecated in favor of Safari App Extensions?If yes, how soon do existing Safari Extensions need to be transitioned to a Safari App Extension? AKA: How long until my Safari Extension breaks or is no longer supported for new users?Some background: I'm a web developer and would like to create a new version of my Safari Extension. I see the "suggested" way of doing this is now to create a Safari App Extension in Xcode, which requires building the extension primarily in Xcode and involves learning Swift (or Objective-C). This seems like a massive hurdle compared to Chrome, Firefox, and Opera who all support the same WebExtensions API. I'm wondering if it's worth the trouble of building a completly separate app extension for Safari, or if we can continue using the Safari Extension builder?
Post not yet marked as solved
Hi,I'm trying to investigate the new Safari App Extension architecture but cannot even get through this basic tutorial:https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW1FWIW, I'm on El Capitan 10.11.6. My Safari version is 10.0.1. I'm using Xcode 8.0. The only deviations from the tutorial are in the targets that I have defined. I created a new project based on the OSX Cocoa Application template. I then added a macOS Safari Extension template - they are both unmodified. This builds and runs as expected; an empty application window pops up.In Safari, I then navigate to Preferences -> Extensions. The extension bundled with the app is not available in the left hand pane as directed by the tutorial.I have got the Develop menu enabled and "Allow unsigned extensions" is checked. I suspect this is some kind of signing issue and that Xcode is ignoring my extension. Each target is "Ad Hoc Signed". FWIW - I did try adjusting Build Settings to "Don't Code Sign" for each target but see the same problem. Anyone out there experiencing similar issues or have good advice on how to resolve this. I see nothing indicating a problem in any logs and am not sure how to go about debugging this. Any advice would be greatly appreciated!
Post not yet marked as solved
Hello there,We have built a Safari extension and submitted it following instructions at https://developer.apple.com/safari/extensions/submission/The submission went through, however, it does not show up in any of the ituens connect stuff and there is no way for us to get the status of the extension?Could someone help us out ?Thanks,Harsha
Post not yet marked as solved
I am trying to implement Google Analytics with my extension that is built with the Extension Builder. Is there any guides or advice on how to go about implementing this?My extension consists of a global.html and popover.html file only. I tried putting the GA snippet in both and it is seemingly not working. I can see through the console that when the GA snippet is in the popover.html, a network request is being made to the GA server, but it doesn't seem to be tramistting the data. If I run my extension locally (it's using plain web technologies), I can see on my analytics page that it is registering my activity; this doesn't happen whilst using the extension.Any help or advice would be appreciated.
Post marked as Apple Recommended
Hey everyone,I have a Chrome and Firefox extension that I'm trying to port over to Safari however I'm running into a few issues.I can't seem to find a way to run similar code to these two functions:chrome.extension.connect (or browser.runtime.connect in Firefox)chrome.tabs.query({active: true, currentWindow: true, url: ["http://*/*", "https://*/*"]}, function(tabs) (runs the same on firefox)Anyone know a workaround in safari that might be useful? I've scoured the web and can't seem to find a good solution.
Post not yet marked as solved
Hi,which App can create a ToolbarItemIcon.pdf for a Safari App Extension?Regards
Post not yet marked as solved
Hi,how can I create a transparent scalable ToolbarItemIcon.pdf for a SafariExtension?Regards
Hello!I've started a new iOS project enabling the option to deploy the same app in macOS (Catalyst). But when I try to create a Safari Extension, I get the following error'Safari Extension.appex' is a Safari extension, which is not available when building for Mac Catalyst. You may need to restrict the platforms for which this app extension should be embedded in the target editor.In the target editor Frameworks, Libraries and Embedded Content I've selected only the macOS platform in my Safari Extension, but I get the same error, any clue?thanks for your time
Post not yet marked as solved
The use case is enterprise Admin wants to enable/disable Safari Extension without user's involvement. Currently, the onus is on User to enable/disable the extension.
In managed endpoint environment, the Admin needs control to enable certain extension silently/automatically (without user's involvement)
I am trying to run JavaScript only after the page has loaded, and according to here - https://developer.apple.com/documentation/safariservices/safari_app_extensions/injecting_a_script_into_a_webpage, I should use DOMContentLoaded. However, it does not seem to work.
This is my content.js file:
function runOnStart() {
document.addEventListener('DOMContentLoaded', function(e) {
document.body.style.background = "rgb(20, 20, 20)";
document.html.style.background = "rgb(20, 20, 20)";
var divElements = document.body.getElementsByTagName('div');
for(var i = 0; i < divElements.length; i++) {
let elem = divElements[i];
elem.style.background = "rgba(255, 255, 255, 0.05)";
}
});
}
runOnStart();
If I take the code outside of the event listener, it runs fine, but a lot of the elements haven't loaded in yet so it doesn't work as it should.
The function is definitely running, but the event listener simply doesn't work. I appreciate any help you can give!
Post not yet marked as solved
I'm working on a Safari Web Extension. I can send a message from the background page to the app extension using browser.runtime.sendNativeMessage, however I'm not able to receive any response.
Similarly, when I run the sample code for Messaging a web extension's native app - https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_a_web_extension_s_native_app, this code is executed:
browser.runtime.sendNativeMessage("application.id", {message: "Hello from background page"}, function(response) {
console.log("Received sendNativeMessage response:");
console.log(response);
});
There should be a log on the background page saying "Received sendNativeMessage response:". However it looks like the response handler never runs. Am I missing something ?
Post not yet marked as solved
Currently, if a page csp disallows inline scripts, but the content script attempts implant inline scripts (DOM injected scripts) - the code will fail to execute.
This is an issue with the current Safari extension model. The effect of this is that content scripts that inject dynamic (user-generated) content can not properly interact with the page context.
This is also an issue with other major browsers, however I do not believe Chrome has this restriction. The reason I say "do not believe" is because the documentation indicates that "page csp does not apply to content scripts", but I have not personally tested this.
I'd like to know is this restriction will be present with the new Safari WebExtension model, especially considering that webRequestBlocking is not supported (which would be the only workaround I am aware of).
Post not yet marked as solved
It is possible to use firebase Apple login inside Web extension?
I can use Google login. But with Apple it is no so clear.
As we have to fill website url when creating service id.
https://developer.apple.com/account/resources/identifiers/list/serviceId
and web extension don't have website url.
Hi,
I am trying the new Safari WebExtension on Safari 14 beta on Majove, everything seems smooth so far except one thing:
The ajax request in the background will always fail since it is cross origin.
Here is the error image - https://okta.box.com/s/q1zacdkeu3exe1ckxsba21l3kuhyzuby
This is not an issue on Chrome, and I think it make sense because the Web Extension background page's Origin is always the WebExtension protocol(like "chrome://<uuid>"), and should approve all the request even if the origin mismatch
But in Safari WebExtension it is not allowed. Even if I add the "Access-Control-Allow-Origin: *" header in the server's response header, the background page requests still fails.
The only way I can make it working is to disable the cross origin restrictions in the Develop menu, but that is not a solution for production.
Any advice to resolve this?
Thanks a lot
Post not yet marked as solved
Hello,
I am in the process of converting a Web Extension to a Safari Extension. I need to use browser.downloads.onCreated.addListener in my extension but the browser.downloads API is not supported yet.
Do I have another way to do that?
Post not yet marked as solved
Hi,
It seems that the browser.runtime.onInstalled API is not working on Safari WebExtenison.
According to MDN - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled, that API is supported, but according to my test, either installing it or toggling enable/disable checkbox on the Preference menu, the event listener is not called.
Not sure it is my testing issue or it is actually not supported.
Thanks!
Post not yet marked as solved
Hello I am facing issue while implementing
browser.tabs.onUpdated.addListener(function (tabID, changeInfo, tab)....
This is only working while page is getting reloaded but if only URL is updated without reloading the page this event is not firing.
The same thing is working fine in firefox and chrome.
Do I need to add something extra?
Post not yet marked as solved
Currently trying to port a web extension over to safari which heavily relies on the include\_globs property of content\_scripts.
Is this something Safari plans to support?
Recently, I came across this doc in developer documentation which explains about converting an existing App Extension to a Web Extension ( https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_safari_app_extension_to_a_safari_web_extension ). This is a welcome feature that will help migrating users from App Extension to Web Extension seamlessly. However, what was not clear from that document was the behavior of Permissions Popup post migration/conversion.
In the new Web Extensions, if a Content Scripts is injected into any web site, there's a permission popup that appears asking the users whether that should be allowed. For the App Extension, such a popup did not exist and permissions to inject Content Scripts were already granted at install time. For a Web Extension that is installed as a result of this migration from App Extension, will this permission popup still be shown or will it be implicitly granted the same permission as the App Extension? Can someone clarify?