Post not yet marked as solved
Hello all!
Is there a way to detect with JavaScript if the website runs inside the iPhone's Safari Browser or inside an application SafariServices?
I found scripts but it detect WebView or not. What I want to is detect SafariServices.
Any suggestion or solution would be great!
Thanks..
Post not yet marked as solved
I am trying to click a button programmatically using JavaScript. It is working in macOS Safari, but it doesn't work in iOS Safari. The document.getElementById("buttonid") returns the button, but when I click it, it doesn't do anything. I've spent a lot of time researching what could be the problem, but I couldn't find any solution. I assume it is somehow blocked on iOS.
Here is my code for clicking a button:
document.getElementById("buttonid").click();
Does anyone know what could be the problem? Thanks in advance
Post not yet marked as solved
Observation for iPhone 7 that the WebRTC sample peer connection demo works on Wi-Fi, but does not work on mobile networks. Same results with both iOS 15.1 and 15.2.
https://webrtc.github.io/samples/src/content/peerconnection/pc1/
Post not yet marked as solved
I'm developing Safari App Extension for iOS 15.0+ and I need to get URL of active tab in popup.js and display.
Here is how I do that in popup.js:
document.getElementById("activetaburl").innerHTML = document.URL
As result it returns path of current popup.js
Here is my permissions from manifest.json:
"permissions": ["nativeMessaging", "activeTab"]
And info.plist:
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer> <key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
</dict>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
</dict>
</dict>
So how to fix the issue above and get url of active tab?
Thanks,
Serge
Hello,
Is anyone else getting an error message like this,
Safari could not open the page because the server stopped responding
It suddenly stopped working after I clicked on the option to close all my tabs and refreshed the application.
I am unable to browse anything. The internet side of things seem to be working fine. Pretty sure its a Safari issue.
Post not yet marked as solved
In my application i have implemented DeepLink, now i am scanning one DeepLink url QR code via camera and url is opening in safari now i want to check if app is not installed user should redirect to Appstore. Right now it redirect me to safari browser after scan. how can we check it ? do we need to add anything on server side. (I have added apple-app-site-association file to server side).
Thanks in advance
Post not yet marked as solved
If you visit the website https://www.deutschlandfunk.de/ (or https://www.deutschlandfunkkultur.de/)
with Safari and browse for a while inside that domain (duration is not fixed neither
the amount of visited pages), images are not loaded any more (unless they are
already in cache). It seems to be necessairy to use the back button while
browsing to trigger that behaviour.
This issue occurs using the Safari browser on Mac as well as on IPhones and IPads.
On iOS it affects Firefox and Chrome too.
As soon as the issue occurs, any new image (e.g. image is not in cache storage) will not be shown.
"A while" can be a few hours. We were not able to find out any event that might be causing this issue.
Cached Images will be shown. Using the inspector you can see, that the browser tries to load the images, but nothing happens. There is no error or warning. It seems, that the request is not fired at all.
Copying the URL of an unloaded image to another browser tab does not load the image neither. Using another browser (on Mac system) loads the image in the other browser.
The issue is reproduceable using the incognito/private mode too.
It seems to be related to the browser session. It works in a newly opened window in private mode or after closing and reopening the browser again, as well in other browsers or with curl on the command line.
It is not related to JavaScript, we disabled JavaScript in Safari and the issue was still reproducible.
Once the browser is in this state, there is no way to load any images from nor do any requests (even for non existent resources) to assets.deutschlandfunk.de or assets.deuschlandfunkkultur.de until restarting it.
Clearing cache, cookies does not help, even after a waking the system up after a few days in sleep mode does not change anything
Thank you!
Post not yet marked as solved
I am running QuickBase scripts on iPads using Safari 15.1. I get arbitrary timeouts of 3 secs which cause the scripts not to run. I do not get this issue in Chrome or Edge on Macs or with Microsoft. Unfortunately, my iPads can only use Safari. Has anyone else had issues with Safari timing out while running any scripts (not necessarily Quickbase)? Is this a known issue? Any help would be appreciated.
Post not yet marked as solved
Apple Team - Need URGENt help with iOS 15.1.1 Safari.
Local Video Media Stream is blank with no audio when we run webRTC app over KMS servers in safari iOS 15.1.1
Some of the experimental settings of Safari are causing the issue and we donno which one.
There is no error reported either on console or during media exchange.
We heard this is an issue with many of the WebRTC + Media Server apps . Request urgent attention and help.
Thank You.
Post not yet marked as solved
Hey Everyone,
I’m developing PWA for one project and i found that after update (13.6) on every phone i tested (iPhone 7 plus , iphone Max Pro , PWA Application freeze.
Freeze Mode : Open App
Go to home screen wait 5-10 seconds
Reopen app
If i go to home screen second time and then again return to app it starts working , no console errors .
please help .
service worker with / without has no effect .
Post not yet marked as solved
This documentation guide and the corresponding demo project show how the the Web Extension Handler can inherit from NSExtensionRequesetHandling and implement beginRequest to receive and reply to messages sent from the background script via browser.runtime.sendMessage().
The guide also mentions how browser.runtime.connectNative and SFSafariApplication.dispatchMessage can be used to send messages from the Handler to the background script, but the code is not in the example project.
Further, it seems that SFSafariApplication is not available on iOS.
How can I send a message originating from the Extension Handler to notify the background script of events coming from native code (e.g. UserDefaults changes)? Is polling from the background script the only option?
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
Hello guys,
I am currently working on a safari app extension that blocks content. I want the user to configure the rule (turning a rule on and off). Since I can’t overwrite the bundled JSON files and we can’t write to the documents folder, as it’s not accessible to the extension I decided to use App Groups. My approach looks like this:
Within the ContentBlockerRequestHandler I want to save the blockerList.json into the app group (Only when launched for the first time)
When this is done I want that the handler reads from the app group by taking the url of my json which is within the app group instead of taking the default json in the extension
Since I can not debug the handler I don't know if I am on the right path. The following shows my code:
/ /
class ContentBlockerRequestHandler: NSObject, NSExtensionRequestHandling {
func beginRequest(with context: NSExtensionContext) {
guard let rulesUrl = loadRules() else {
let clonedRules = cloneBlockerList()
save(rules: clonedRules)
return
}
guard let attachment = NSItemProvider(contentsOf: rulesUrl) else { return }
// let attachment = NSItemProvider(contentsOf: Bundle.main.url(forResource: "blockerList", withExtension: "json"))!
let item = NSExtensionItem()
item.attachments = [attachment]
context.completeRequest(returningItems: [item], completionHandler: nil)
}
private func cloneBlockerList() -> [Rule] {
var rules: [Rule] = []
if let url = Bundle.main.url(forResource: "blockerList", withExtension: "json") {
do {
let data = try Data(contentsOf: url)
let decoder = JSONDecoder()
let jsonData = try decoder.decode(ResponseData.self, from: data)
rules = jsonData.rules
} catch {
print("error:(error)")
}
}
return rules
}
private func save(rules: [Rule]) {
let documentsDirectory = FileManager().containerURL(forSecurityApplicationGroupIdentifier: "my group identifier")
let archiveURL = documentsDirectory?.appendingPathComponent("rules.json")
let encoder = JSONEncoder()
if let dataToSave = try? encoder.encode(rules) {
do {
try dataToSave.write(to: archiveURL!)
} catch {
// TODO: ("Error: Can't save Counters")
return;
}
}
}
private func loadRules() -> URL? {
let documentFolder = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "my group identifier")
guard let jsonURL = documentFolder?.appendingPathComponent("rules.json") else {
return nil
}
return jsonURL
}
}
Thankful for any help
Post not yet marked as solved
I'm building an app that can present a web page via SFSafariViewController. However, I found that when opening a web page (powered by SFSafariViewController) for which there is an iOS app installed, the smart app banner doesn't show up (https://ibb.co/B3mNS0c) so there is no way to segue from the page to the app. I checked the same page loaded directly on Safari iOS app, the banner indeed shows up https://ibb.co/xmw7vDy.
Does anyone know how I can enable the banner for the page presented within my app? Thanks!
Post not yet marked as solved
Hello,
I have use Safari content blocker extension on Mac Catalyst application.
Here is the code for reloadContentBlocker
// Config.BLOCKER_EXTENSION = Content blocker extension bundle identifier
func reloadBlockerRules() {
if #available(macCatalyst 13.4, *) {
SFContentBlockerManager.reloadContentBlocker(withIdentifier: Config.BLOCKER_EXTENSION, completionHandler: { error in
if error != nil {
TextLog.shared.write("RELOAD OF \(Config.BLOCKER_EXTENSION) FAILED WITH ERROR -\(error?.localizedDescription ?? "")")
}
})
} else {
// Fallback on earlier versions
TextLog.shared.write("Fallback on earlier versions - reloadBlockerRules")
}
}
I have reload the blocker rules on application startup but its cashing every time with following reason :
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSXPCInterfaceProxy_SafariExtensionHelperProtocol loadContentBlockerWithIdentifier:sandboxExtensionToken:invokedBySafariFamily:reply:]: unrecognized selector sent to instance 0x6000012ac370'
terminating with uncaught exception of type NSException
abort() called
Can you please help me out for find the crash reason ?
Post not yet marked as solved
do we have settings for changing search provider through extension on latest iOS 15?
Hi everyone:
How all we know the use of App-Prefs:root is a headache, because it causes rejection in AppStore, because it's considered that root and following is a private API. The app-settings: scheme redirect to our app settings, and that's not the behaviour expected
@eskimo what about only use App-Prefs:? Is it considered private API? Is it not an app scheme?
We have a lot of issues open by users because the mobileconfig download, since iOS 12.2 from Safari, not redirect the user to the profile settings.
Users complain because of it, and maybe with the simple fact of could open settings not our app settings, the settings app could solve the problem because of the iOS Bug is not resolved nowadays.
Thanks for all,
Best regards,
Post not yet marked as solved
Where can I find sample codes and some api listing for iOS only?
Post not yet marked as solved
in one secound seen that in one of the tab showing facebook.com webpage.
Tried all the solution on internet forum, but unable to over come.
please do share file system solution or new app.
Post not yet marked as solved
I'm using SFSafariViewController for load weblinks,
In my case first I need to open one URL after some process/time(like 10 sec) I need to update my URL in the same tab and refresh SFSafariViewController.
if let url = URL(string: "Google.com") {
let VC= SFSafariViewController(url: url)
VC.delegate = self
self.present(VC, animated: true, completion: nil)
}
There is any way to update The URL and refresh the current SFSafariViewController page?