Safari Developer Tools

RSS for tag

Inspect, edit, debug, and check the performance of your web content using Safari developer tools.

Posts under Safari Developer Tools tag

200 Posts

Post

Replies

Boosts

Views

Activity

Error while launching safari browser using selenium webdriver--python
Hello Guys,I am getting below error when tried to launch Safari browser using Selenium Webdriver with Python code. I don't have admin rights on my Mac.Traceback (most recent call last): File "BraveTest.py", line 45, in <module> driver = webdriver.Safari(executable_path = safari_driverpath) File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/safari/webdriver.py", line 57, in __init__ self.service.start() File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running % (self.path, return_code)selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/safaridriver unexpectedly exited. Status code was: 1Code:from selenium import webdriverdriver = webdriver.Safari()As per the below instruction mentioned in the page @ https://webkit.org/blog/6900/webdriver-support-in-safari-10/“Authorize safaridriver to launch the webdriverd service which hosts the local web server. To permit this, run /usr/bin/safaridriver once manually and complete the authentication prompt.”I ran the command “/usr/bin/safaridriver –enable” in the mac terminal and it asked for the password. I have entered my user password but got the message saying password is not valid. Does it require Admin Password.Pls help me resolve this issue.Thanks in Advance.
6
0
7.8k
Mar ’23
Advice on implementing Dark Mode CSS with a theme toggle
Working on a website and I want to add a light / dark theme. I also want to add a toggle on the page to switch between those two modes. By default, it goes with the system color theme and then overrides are set with localstorage on the color toggle. What is the best way to implement the styles? Is using css vars with a selector between light and dark the best move? Should there be a default styling and then override based on a data attribute on body? (Would this cause flashing on load?) Any advice helps. Thanks in advance!
4
0
1.4k
Mar ’23
SharedArrayBuffer in AudioWorkletProcessor not working in Safari (macOS)
Hi, I'm trying to use ShareArrayBuffer with Audio Worklets but it does not seem to work. It works fine with Chrome. The Share Array Buffer sample from here, works well with Chrome, but not with Safari. https://googlechromelabs.github.io/web-audio-samples/audio-worklet/design-pattern/shared-buffer/ There's no error indicated in the JS Console, either. This seems related to the following WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=237144 But that is marked as been resolved. Tried using the Safari Technology Preview (v 165) - but that has even bigger problems. It does not even recognize AudioWorkletNode class! Am I missing something? Thanks. Devendra.
0
0
1.2k
Mar ’23
Local Storage Policy Change in Safari 16.1+
Hi, To the best of anyone's knowledge, has there been any word from Apple on changes to Local Storage policies in Safari 16.1 and beyond? Starting around October 24th we began to see users of one of our applications fail to make a bridge from one application to another. In short, we use an iframe to set information in local storage on a subdomain. When we move the user to that subdomain and go to retrieve local storage it is no longer there. In all previous versions of Safari, current and past versions of Chrome and Firefox the solution works. We can only ascertain that this is a bug or a bug that appears to look like a security feature. Related posts we have reviewed have mentioned Local Storage size limits, etc. We see this issue at any size. We need some direction from the developer community on what this is and where it may go. Do you have any information?
2
2
2.9k
Mar ’23
Safari: Cookies stored under Storage > Cookies do not match the ones listed on document.cookie
Hi! I'm facing the following issue in different versions of Safari: When removing cookies via PHP on log out of an application I can see that the Safari Developer Tools > Storage > Cookies (of the website) removes the cookies from the list. So my user cookie is no longer there as expected, all good. However, if I run document.cookie on the console or document.cookie.includes('user') I can see the cookie listed there. I would expect the document.cookie to be updated with the Storage tab as it happens on the other browsers. Does anyone know why is this happening? Is there anything special that must be done for Safari to remove the cookie from there? This behaviour is consistent in versions v14, v15 and v16 of Safari. Thank you for your time. Regards, Borja.
1
0
1.2k
Mar ’23
Iframe session storage is considered as isolated session and new session is created when redirected to the iframe URL directly
The session storage added in iframes are not maintained which going to it directly in same tab. This happens only in Safari latest version 16.1 and Business impact is happening Steps to replicate it Note: Pls add w w w. in front for URLs  Go to premierinn.com/ and in session storage you can see secure2.premierinn.com (which is an iframe in this page) as shown in Premierinn_home.png attached image.  Add new test key/value to secure2.premierinn.com session storage as shown in Premierinn_addSession.png attached image.  Go to this URL premierinn.com/gb/en/hotels/england/greater-london/london/london-barking.html?ARRdd=05&ARRmm=04&ARRyyyy=2023&NIGHTS=1&ROOMS=1&ADULT1=1&CHILD1=0&COT1=0&INTTYP1=DB&BRAND=PI and you can see the session storage in secure2.premierinn.com still have testkey we added in previous step as in Premierinn_HDP.png attached image  Click Book now and this will redirect to secure2.premierinn.com/gb/en/booking-a1/extras.html in which the new key we added last steps is not visible in safari 16.1 as in Premierinn_session_cleared.png attached image  But the same is retained in safari lower versions like 15.3 Premierinn_session_maintained_15.3.png attached image.. Also working in all latest versions of Chrome, Firefox.
1
0
1.7k
Mar ’23
Service worker behavior (clients urls)
My SPA uses PWA technologies handling service workers with Workbox. While knocking to SW clients with self.clients.matchAll({ type: 'window' }).then(...) and then trying to do actions with clients urls found out a strange difference between SW behavior in Safari and Chrome. In Chrome the client.url field always contains the current url of every tab whenever and wherever you check it. In Safari client.url field contains the entry url for every tab and never changes wherever you navigate the page (mean - the client of the SW). The behavior in Chrome seems to be more proper, cause if you want, for example, to refresh all tabs you aren't able to ensure user's data safety and your app provides bad users experience dropping them to other url. Could you please consider this case. Thank you.
0
2
737
Mar ’23
PWA Freezing after OpenID authorizes user [iOS Safari Standalone]
PWA Freezing after OpenID authorizes user [iOS Safari Standalone] I have built a simple PWA for our security staff that allows employees to click links and view content about our company's policies on various matters. The app uses Microsoft's OWIN middleware library to authorize our employees' access into the app via their enterprise Microsoft login creds. When a user clicks the 'Employee Sign in' prompt on our login page, they are redirected to Microsoft's domain to complete the sign-in process. Once sign in is complete, they are redirected back to our app's home page. The Problem The problem appears only to arise when iOS users (v13) pin the app to their homescreen and then launch the app in standalone mode, and only after the user has completely terminated the app and then returned. We've tested the app on Chrome, Safari (non-standalone mode), Firefox, and the issue does not present in those browswers. The app functions seamlessly up until the point that the user has completed their Microsoft signin and been redirected back to the home page. At this point, if a user clicks a link to another page (within the app), the app completely locks up, doesn't respond to further button clicks, and doesn't load the page prompted by the user. No errors are thrown in the console. What we've found immediately kicks everything back into gear is if the user switches to another app (even just for a second) and then switches back to our PWA when it's locked up. At this point, the page that the user attempted to navigate to loads immediately without further prompting and the app works 100% seamlessly after this point. It's only the initial version of the default page that freezes. Potential Causes My current working theory is that the problem is being caused by some combination of the following: Redirection to Microsoft's sign in portal. When the user is sent to Microsoft for auth and then sent back to our domain, there could be issues with session/cookie continuity. iOS's standalone mode. In conjunction with the above, is it possible that using third-party authentication and briefly leaving the domain of the PWA is causing problems with future page navigation. This is supported by the idea that no other browsers or devices have this issue, and my research suggests that Apple support for PWAs is still in its early stages. Service worker failure. We have done significant testing to ensure that a service worker is being properly installed and registered when a user first enters the site. We have checks to re-register the SW just in case it is dropped at any point in page navigation. We are confident that at the time a user is redirected back to our home page after authentication that there is an active service worker that handles page GET requests. I have also tested explicitly caching the linked pages accessible from our home page during the service worker's registration to see if serving the page from the cache would alleviate the issue. It did not. This is the code in sw.js that handles fetch requests (taken from Google's handy guide): 	// "cache-first" approach for requests from client. Will try to get the file from the cache. 		// If no match found, it will send the request onto the network. If both fail serve fallback page. 		self.addEventListener("fetch", function (event) { 				if (event.request.method !== "GET") return; 				event.respondWith( 						// Try the cache 						caches.match(event.request).then(function (response) { 								console.log("[service worker] attempting to fetch file from cache..."); 								return response || fetch(event.request); 						}).catch(function () { 								// If both fail, show a generic fallback: 								return caches.match(offlineFallbackPage); 						}) 				); 		}); I have remotely debugged the PWA in standalone using a Mac, and what I have verified is that the click event that fires when a user clicks a link to navigate to a new page IS being properly handled, so the problem truly appears to lie in the loading of the linked pages themselves. Beyond that, debugging remotely has confirmed that there are no HTTP GET errors (or any other errors) firing at all when attempting to navigate to other pages on the site. This is the first PWA I've ever built and I'm a novice with all this stuff. So I'd love to know if I'm missing anything or where I can go from here. I've scoured all the forums and can't seem to find answers anywhere. Thanks!
4
1
3.1k
Mar ’23
Safari developer console “computed panel” next to the CSS
Hello, does somebody how to get rid off this “conputed panel” next to the basic CSS tab? If I am trying to hide it, I can’t, even I disable the CSS tab, I can’t. I don’t see any solution here on forum even on the internet or in setting the console or on official WebKit page, where this part is mentioned. Here is the mention of the “computed panel” - https://webkit.org/web-inspector/elements-tab/
1
3
2.5k
Mar ’23
Safari "WebKit Build Archives" crashes when opening Preferences
Summary Safari "WebKit Build Archives" (AKA Safari nighties) crashes when opening Preferences. The Preference window doesn't even pop up before crashing. Steps to reproduce Download a nightly build of Safari https://webkit.org/build-archives/#mac-monterey-x86_64 Open run-webkit-archive Go got Safari > Preferences Observer crash Environment Does crash on: MacBook Pro (15-inch, 2017) macOS 12.2.1 and 12.3.1 WebKit Build Archives (249860@main, 249854@main, 249817@main, 292562) Spot checked a few others from Feb to April as well Do NOT crash on: Safari included with macOS 12.3.1 (Version 15.4 (17613.1.17.1.13)) Safari Technology Preview 143 (Safari 15.4, WebKit 17614.1.7.7) 142 141 Crash stack trace 2022-04-21 13:44:00.485 SafariForWebKitDevelopment[13786:133729] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:477 2022-04-21 13:44:00.487 SafariForWebKitDevelopment[13786:133729] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil' *** First throw call stack: ( 0 CoreFoundation 0x00007ff8112d81e3 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff811038c13 objc_exception_throw + 48 2 Foundation 0x00007ff81217ac23 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 267 3 AppKit 0x00007ff813c74759 -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363 4 Safari 0x00007ff91e63417a +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140 5 Safari 0x00007ff91e505a0b -[GeneralPreferences _updateDownloadLocationMenu] + 158 6 libdispatch.dylib 0x00007ff810fda0cc _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x00007ff810fdb317 _dispatch_client_callout + 8 8 libdispatch.dylib 0x00007ff810fe7c78 _dispatch_main_queue_drain + 943 9 libdispatch.dylib 0x00007ff810fe78bb _dispatch_main_queue_callback_4CF + 31 10 CoreFoundation 0x00007ff81129a9c7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x00007ff81125b93f __CFRunLoopRun + 2771 12 CoreFoundation 0x00007ff81125a7ac CFRunLoopRunSpecific + 562 13 HIToolbox 0x00007ff819ee1ce6 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007ff819ee1a4a ReceiveNextEventCommon + 594 15 HIToolbox 0x00007ff819ee17e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 16 AppKit 0x00007ff813c8153d _DPSNextEvent + 927 17 AppKit 0x00007ff813c7fbfa -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394 18 Safari 0x00007ff91e16d8b5 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224 19 AppKit 0x00007ff813c722a9 -[NSApplication run] + 586 20 AppKit 0x00007ff813c46227 NSApplicationMain + 817 21 Safari 0x00007ff91e1581c0 SafariMain + 464 22 dyld 0x000000011583e51e start + 462 ) libc++abi: terminating with uncaught exception of type NSException MessageReceiveQueueMap::addImpl - adding duplicate any id receiver 35
2
3
1.6k
Feb ’23
SafariForWebKitDevelopment preferences crash, can't enable develop menu
I'm trying to run safari with a build of webkit that includes Atomics.waitAsync, and I can't enable the develop menu as the settings screen crashes. Is there a way to workaround this bug, by enabling the develop menu in the terminal? Or do I need to downgrade my MacOS version https://share.cleanshot.com/3Q5XFw kEventMenuPopulate to menu 'Safari' kEventMenuPopulate to menu 'Debug' 2022-12-04 16:28:38.903 SafariForWebKitDevelopment[13812:2325596] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:467 2022-12-04 16:28:38.905 SafariForWebKitDevelopment[13812:2325596] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil' *** First throw call stack: ( 0 CoreFoundation 0x00007ff80f10141b __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff80ec4fe25 objc_exception_throw + 48 2 Foundation 0x00007ff80ffa3fb0 -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00007ff8121c08bc -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363 4 Safari 0x00007ff9197fb5cd +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140 5 Safari 0x00007ff9196a1da0 -[GeneralPreferences _updateDownloadLocationMenu] + 158 6 libdispatch.dylib 0x00007ff80ee2c7fb _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x00007ff80ee2da44 _dispatch_client_callout + 8 8 libdispatch.dylib 0x00007ff80ee3a7b9 _dispatch_main_queue_drain + 952 9 libdispatch.dylib 0x00007ff80ee3a3f3 _dispatch_main_queue_callback_4CF + 31 10 CoreFoundation 0x00007ff80f0c7620 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x00007ff80f087ba0 __CFRunLoopRun + 2454 12 CoreFoundation 0x00007ff80f086b90 CFRunLoopRunSpecific + 560 13 HIToolbox 0x00007ff8189c76a6 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007ff8189c74b6 ReceiveNextEventCommon + 679 15 HIToolbox 0x00007ff8189c71f3 _BlockUntilNextEventMatchingListInModeWithFilter + 70 16 AppKit 0x00007ff8121ccf63 _DPSNextEvent + 909 17 AppKit 0x00007ff8121cbde4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219 18 Safari 0x00007ff919419253 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224 19 AppKit 0x00007ff8121be423 -[NSApplication run] + 586 20 AppKit 0x00007ff812192457 NSApplicationMain + 817 21 Safari 0x00007ff9197c1e77 SafariMain + 464 22 dyld 0x00007ff80ec7c310 start + 2432 ) libc++abi: terminating with uncaught exception of type NSException zsh: abort ./SafariForWebKitDevelopment
0
0
1.8k
Feb ’23
file: XML and XSLT in WKWebView
Has anyone ever tried to use XML & XSLT in WKWebView, with the files included in the app bundle? I.e. example.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="transform.xslt"?> <page> </page> transform.xslt: <xsl:transform   version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="page"> <html> <body> <p>Hello World</p> </body> </html> </xsl:template> </xsl:transform> When I attempt to load that as file:///path/to/bundle/example.xml, I get a blank page (and nothing in the console). Various questions: I know that generally web console output inside apps doesn't appear in the logs, and there are various suggestions about injecting user scripts to fetch them by replacing e.g. console.log. But does that only fetch errors generated by Javascript, or does it also fetch other error messages? Should I be able to attach to my WKWebView's console from Safari on my Mac, over USB? If I try to view the same file using a file: URL in Safari on my Mac, I discover that security policy prevents a file: XML document from using a file: XSLT even if they are in the same directory; it considers all file: URLs to have different origins. I don't see that error with the WKWebView, hence question (1). Is there anything that I can do with WKWebView to permit access from a file: XML document to a file: XSLT document in the same directory, within the app bundle? I have tried using loadURL: allowingReadAccessToURL:, and that doesn't seem to work. I'm also aware of the WKSecurityOrigin type, and I wonder if I can use that to persuade WKWebView that the XML and XSLT are "same origin". Does this require that I implement a "content blocker"? Can a content blocker ever relax restrictions, rather than tightening them? Thanks for any suggestions!
0
0
841
Feb ’23
Receiver class org.openqa.selenium.safari.SafariDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract com.google.common.collect.ImmutableList createArgs()' of abstract class org.openqa.selenium.remote.ser
Hello, I am new to safari, and the safari web driver and I am trying to write a java program using selenium to open a web page.... import org.openqa.selenium.WebDriver; import org.openqa.selenium.safari.SafariDriver; // import org.openqa.selenium.Saf // I have not imported the following // import org.openqa.selenium.safari.SafariDriver; // because this does not provide me with the SafariDriver. public class Test_SafariDemo { // the purpose of this class is to test the Safari driver // Written by Michael John Little // Based on a Java program from... // https://www.browserstack.com/guide/run-selenium-tests-on-safari-using-safaridriver public static void main(String[] args) { // lets Instantiate a Safari driver class WebDriver drvr =null; try { drvr = new SafariDriver(); } catch (Exception e) { System.out.print(e); } // lets Launch the Google website drvr.navigate().to("http://www.google.com/"); // lets click on the search box and send a value drvr.findElement(By.id("lst-ib")).sendKeys("BrowserStack"); // click the search button drvr.findElement(By.name("btnK")).click(); //close the browser //drvr.close(); }// close public static void main(String[] args) } // public class Test_SafariDemo But I am getting the following [exception] message when I execute my code... Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.safari.SafariDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract com.google.common.collect.ImmutableList createArgs()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder. at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:358) at org.openqa.selenium.safari.SafariDriverService.createDefaultService(SafariDriverService.java:75) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:60) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:49) at Test_SafariDemo.main(Test_SafariDemo.java:25) Process finished with exit code 1 Any suggestions? Are there configuration options that I need to set when I instantiate the safariDriver class with?
1
0
1.4k
Feb ’23
Safari inspector problems with Element tab and Console
Hello, I have a problem with console, in Safari. In Safari for developers (tech. preview) i see more informations in console than in basic Safar (the blue one), but this things all just normal logs from console.log(), I see them before in Safari (blue one) before, but i did not see them now, can you try help me solve this out? Also I have a issue in Element tab, with the sidebar. I use the CSS tab, this is okay, but the marked one on the screenshot I don't have for time, but now it appears from nowhere and I don't know how to get rid of that. Thanks for help, I will be very happy if someone know hot to solve that, because Apple support doesn't help me so much.
0
0
790
Feb ’23
Connection drop with Safari/F5
We have an IIS website(ASP.net) that work at many location. We have a client where the website is hosted on IIS behind an F5(Big IP). When the client is connecting we have intermittent lost of connection. The issue arises more often with the Safari/Iphone. I have tried many things to find the issue but I'm running out of idea.Here is a Network trace gathered with Safari. You will see that I have many red lines that are requests that did not make it to the server. The requests for resources named 6-.ice are images while the 4-.ice are XHR requests: https://i.stack.imgur.com/lrIG7.png The XHR Request HTTP Status was 0. When it happens, we redirect the user to the BadRequest.htm page.I have validated the possible issue with HTTP/2 and connection HTTP header but everything is still on HTTP/1.Thank you!
1
0
1.1k
Jan ’23
Unable to play video in mac safari and iphone using HTML5 video tag
In my application which records the video from any device and saving in aws server, and admin can play recorded videos from any os/ device. After the ios updated on Dec 14 2022, my video component is messed up, I cannot record or play video from apple devices. As I cannot write entire project code, I have the code in the below link [https://github.com/amran-quantum/videoplayertesting/blob/main/index.html) This video is playing in mac chrome but NOT in mac safari and any of the iphone devices. I am struggling since 15 days.
0
0
1.3k
Jan ’23
Inspect WebView in Mac Application
Hello,What is the proper way to inspect a WebView in a Mac application?I can access any iOS simulator or connected device through the Safari Develop menu just not any Mac apps (The entry for the Mac lists "No Inspectable Applications").All the Mac apps are launched by Xcode and the scheme is set to debug.Is there something I am missing or are Mac apps not supported? I tried to search the documentation but found nothing.Thanks.
5
0
20k
Jan ’23
Error while launching safari browser using selenium webdriver--python
Hello Guys,I am getting below error when tried to launch Safari browser using Selenium Webdriver with Python code. I don't have admin rights on my Mac.Traceback (most recent call last): File "BraveTest.py", line 45, in &lt;module&gt; driver = webdriver.Safari(executable_path = safari_driverpath) File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/safari/webdriver.py", line 57, in __init__ self.service.start() File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/Users/p785756/Library/Python/3.6/lib/python/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running % (self.path, return_code)selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/safaridriver unexpectedly exited. Status code was: 1Code:from selenium import webdriverdriver = webdriver.Safari()As per the below instruction mentioned in the page @ https://webkit.org/blog/6900/webdriver-support-in-safari-10/“Authorize safaridriver to launch the webdriverd service which hosts the local web server. To permit this, run /usr/bin/safaridriver once manually and complete the authentication prompt.”I ran the command “/usr/bin/safaridriver –enable” in the mac terminal and it asked for the password. I have entered my user password but got the message saying password is not valid. Does it require Admin Password.Pls help me resolve this issue.Thanks in Advance.
Replies
6
Boosts
0
Views
7.8k
Activity
Mar ’23
Advice on implementing Dark Mode CSS with a theme toggle
Working on a website and I want to add a light / dark theme. I also want to add a toggle on the page to switch between those two modes. By default, it goes with the system color theme and then overrides are set with localstorage on the color toggle. What is the best way to implement the styles? Is using css vars with a selector between light and dark the best move? Should there be a default styling and then override based on a data attribute on body? (Would this cause flashing on load?) Any advice helps. Thanks in advance!
Replies
4
Boosts
0
Views
1.4k
Activity
Mar ’23
SharedArrayBuffer in AudioWorkletProcessor not working in Safari (macOS)
Hi, I'm trying to use ShareArrayBuffer with Audio Worklets but it does not seem to work. It works fine with Chrome. The Share Array Buffer sample from here, works well with Chrome, but not with Safari. https://googlechromelabs.github.io/web-audio-samples/audio-worklet/design-pattern/shared-buffer/ There's no error indicated in the JS Console, either. This seems related to the following WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=237144 But that is marked as been resolved. Tried using the Safari Technology Preview (v 165) - but that has even bigger problems. It does not even recognize AudioWorkletNode class! Am I missing something? Thanks. Devendra.
Replies
0
Boosts
0
Views
1.2k
Activity
Mar ’23
Local Storage Policy Change in Safari 16.1+
Hi, To the best of anyone's knowledge, has there been any word from Apple on changes to Local Storage policies in Safari 16.1 and beyond? Starting around October 24th we began to see users of one of our applications fail to make a bridge from one application to another. In short, we use an iframe to set information in local storage on a subdomain. When we move the user to that subdomain and go to retrieve local storage it is no longer there. In all previous versions of Safari, current and past versions of Chrome and Firefox the solution works. We can only ascertain that this is a bug or a bug that appears to look like a security feature. Related posts we have reviewed have mentioned Local Storage size limits, etc. We see this issue at any size. We need some direction from the developer community on what this is and where it may go. Do you have any information?
Replies
2
Boosts
2
Views
2.9k
Activity
Mar ’23
Safari: Cookies stored under Storage > Cookies do not match the ones listed on document.cookie
Hi! I'm facing the following issue in different versions of Safari: When removing cookies via PHP on log out of an application I can see that the Safari Developer Tools > Storage > Cookies (of the website) removes the cookies from the list. So my user cookie is no longer there as expected, all good. However, if I run document.cookie on the console or document.cookie.includes('user') I can see the cookie listed there. I would expect the document.cookie to be updated with the Storage tab as it happens on the other browsers. Does anyone know why is this happening? Is there anything special that must be done for Safari to remove the cookie from there? This behaviour is consistent in versions v14, v15 and v16 of Safari. Thank you for your time. Regards, Borja.
Replies
1
Boosts
0
Views
1.2k
Activity
Mar ’23
Iframe session storage is considered as isolated session and new session is created when redirected to the iframe URL directly
The session storage added in iframes are not maintained which going to it directly in same tab. This happens only in Safari latest version 16.1 and Business impact is happening Steps to replicate it Note: Pls add w w w. in front for URLs  Go to premierinn.com/ and in session storage you can see secure2.premierinn.com (which is an iframe in this page) as shown in Premierinn_home.png attached image.  Add new test key/value to secure2.premierinn.com session storage as shown in Premierinn_addSession.png attached image.  Go to this URL premierinn.com/gb/en/hotels/england/greater-london/london/london-barking.html?ARRdd=05&ARRmm=04&ARRyyyy=2023&NIGHTS=1&ROOMS=1&ADULT1=1&CHILD1=0&COT1=0&INTTYP1=DB&BRAND=PI and you can see the session storage in secure2.premierinn.com still have testkey we added in previous step as in Premierinn_HDP.png attached image  Click Book now and this will redirect to secure2.premierinn.com/gb/en/booking-a1/extras.html in which the new key we added last steps is not visible in safari 16.1 as in Premierinn_session_cleared.png attached image  But the same is retained in safari lower versions like 15.3 Premierinn_session_maintained_15.3.png attached image.. Also working in all latest versions of Chrome, Firefox.
Replies
1
Boosts
0
Views
1.7k
Activity
Mar ’23
Unknown group of Simulating of iPhones Attempting to connect located in the Develop Menu
There are 6 iPhones attempting to connect to the internet and I have know idea why or how they got there? see pic iPhone 11 Pro iPhone 11 Pro Max iPhone 8 iPhone 8 Plus iPhone 7 iPhone 7 Plus I keep getting an error message An error occurred uploading this image. Please try again later?
Replies
0
Boosts
0
Views
868
Activity
Mar ’23
Service worker behavior (clients urls)
My SPA uses PWA technologies handling service workers with Workbox. While knocking to SW clients with self.clients.matchAll({ type: 'window' }).then(...) and then trying to do actions with clients urls found out a strange difference between SW behavior in Safari and Chrome. In Chrome the client.url field always contains the current url of every tab whenever and wherever you check it. In Safari client.url field contains the entry url for every tab and never changes wherever you navigate the page (mean - the client of the SW). The behavior in Chrome seems to be more proper, cause if you want, for example, to refresh all tabs you aren't able to ensure user's data safety and your app provides bad users experience dropping them to other url. Could you please consider this case. Thank you.
Replies
0
Boosts
2
Views
737
Activity
Mar ’23
PWA Freezing after OpenID authorizes user [iOS Safari Standalone]
PWA Freezing after OpenID authorizes user [iOS Safari Standalone] I have built a simple PWA for our security staff that allows employees to click links and view content about our company's policies on various matters. The app uses Microsoft's OWIN middleware library to authorize our employees' access into the app via their enterprise Microsoft login creds. When a user clicks the 'Employee Sign in' prompt on our login page, they are redirected to Microsoft's domain to complete the sign-in process. Once sign in is complete, they are redirected back to our app's home page. The Problem The problem appears only to arise when iOS users (v13) pin the app to their homescreen and then launch the app in standalone mode, and only after the user has completely terminated the app and then returned. We've tested the app on Chrome, Safari (non-standalone mode), Firefox, and the issue does not present in those browswers. The app functions seamlessly up until the point that the user has completed their Microsoft signin and been redirected back to the home page. At this point, if a user clicks a link to another page (within the app), the app completely locks up, doesn't respond to further button clicks, and doesn't load the page prompted by the user. No errors are thrown in the console. What we've found immediately kicks everything back into gear is if the user switches to another app (even just for a second) and then switches back to our PWA when it's locked up. At this point, the page that the user attempted to navigate to loads immediately without further prompting and the app works 100% seamlessly after this point. It's only the initial version of the default page that freezes. Potential Causes My current working theory is that the problem is being caused by some combination of the following: Redirection to Microsoft's sign in portal. When the user is sent to Microsoft for auth and then sent back to our domain, there could be issues with session/cookie continuity. iOS's standalone mode. In conjunction with the above, is it possible that using third-party authentication and briefly leaving the domain of the PWA is causing problems with future page navigation. This is supported by the idea that no other browsers or devices have this issue, and my research suggests that Apple support for PWAs is still in its early stages. Service worker failure. We have done significant testing to ensure that a service worker is being properly installed and registered when a user first enters the site. We have checks to re-register the SW just in case it is dropped at any point in page navigation. We are confident that at the time a user is redirected back to our home page after authentication that there is an active service worker that handles page GET requests. I have also tested explicitly caching the linked pages accessible from our home page during the service worker's registration to see if serving the page from the cache would alleviate the issue. It did not. This is the code in sw.js that handles fetch requests (taken from Google's handy guide): &#9;// "cache-first" approach for requests from client. Will try to get the file from the cache. &#9;&#9;// If no match found, it will send the request onto the network. If both fail serve fallback page. &#9;&#9;self.addEventListener("fetch", function (event) { &#9;&#9;&#9;&#9;if (event.request.method !== "GET") return; &#9;&#9;&#9;&#9;event.respondWith( &#9;&#9;&#9;&#9;&#9;&#9;// Try the cache &#9;&#9;&#9;&#9;&#9;&#9;caches.match(event.request).then(function (response) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;console.log("[service worker] attempting to fetch file from cache..."); &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;return response || fetch(event.request); &#9;&#9;&#9;&#9;&#9;&#9;}).catch(function () { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// If both fail, show a generic fallback: &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;return caches.match(offlineFallbackPage); &#9;&#9;&#9;&#9;&#9;&#9;}) &#9;&#9;&#9;&#9;); &#9;&#9;}); I have remotely debugged the PWA in standalone using a Mac, and what I have verified is that the click event that fires when a user clicks a link to navigate to a new page IS being properly handled, so the problem truly appears to lie in the loading of the linked pages themselves. Beyond that, debugging remotely has confirmed that there are no HTTP GET errors (or any other errors) firing at all when attempting to navigate to other pages on the site. This is the first PWA I've ever built and I'm a novice with all this stuff. So I'd love to know if I'm missing anything or where I can go from here. I've scoured all the forums and can't seem to find answers anywhere. Thanks!
Replies
4
Boosts
1
Views
3.1k
Activity
Mar ’23
Safari developer console “computed panel” next to the CSS
Hello, does somebody how to get rid off this “conputed panel” next to the basic CSS tab? If I am trying to hide it, I can’t, even I disable the CSS tab, I can’t. I don’t see any solution here on forum even on the internet or in setting the console or on official WebKit page, where this part is mentioned. Here is the mention of the “computed panel” - https://webkit.org/web-inspector/elements-tab/
Replies
1
Boosts
3
Views
2.5k
Activity
Mar ’23
How to modify headers with Safari on iOS
Hello,Is there a solution to modify headers on safari for iOS just like with ModHeader extension for other browsers ?Thanks for your answer
Replies
7
Boosts
1
Views
14k
Activity
Mar ’23
Safari "WebKit Build Archives" crashes when opening Preferences
Summary Safari "WebKit Build Archives" (AKA Safari nighties) crashes when opening Preferences. The Preference window doesn't even pop up before crashing. Steps to reproduce Download a nightly build of Safari https://webkit.org/build-archives/#mac-monterey-x86_64 Open run-webkit-archive Go got Safari > Preferences Observer crash Environment Does crash on: MacBook Pro (15-inch, 2017) macOS 12.2.1 and 12.3.1 WebKit Build Archives (249860@main, 249854@main, 249817@main, 292562) Spot checked a few others from Feb to April as well Do NOT crash on: Safari included with macOS 12.3.1 (Version 15.4 (17613.1.17.1.13)) Safari Technology Preview 143 (Safari 15.4, WebKit 17614.1.7.7) 142 141 Crash stack trace 2022-04-21 13:44:00.485 SafariForWebKitDevelopment[13786:133729] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:477 2022-04-21 13:44:00.487 SafariForWebKitDevelopment[13786:133729] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil' *** First throw call stack: ( 0 CoreFoundation 0x00007ff8112d81e3 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff811038c13 objc_exception_throw + 48 2 Foundation 0x00007ff81217ac23 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 267 3 AppKit 0x00007ff813c74759 -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363 4 Safari 0x00007ff91e63417a +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140 5 Safari 0x00007ff91e505a0b -[GeneralPreferences _updateDownloadLocationMenu] + 158 6 libdispatch.dylib 0x00007ff810fda0cc _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x00007ff810fdb317 _dispatch_client_callout + 8 8 libdispatch.dylib 0x00007ff810fe7c78 _dispatch_main_queue_drain + 943 9 libdispatch.dylib 0x00007ff810fe78bb _dispatch_main_queue_callback_4CF + 31 10 CoreFoundation 0x00007ff81129a9c7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x00007ff81125b93f __CFRunLoopRun + 2771 12 CoreFoundation 0x00007ff81125a7ac CFRunLoopRunSpecific + 562 13 HIToolbox 0x00007ff819ee1ce6 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007ff819ee1a4a ReceiveNextEventCommon + 594 15 HIToolbox 0x00007ff819ee17e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 16 AppKit 0x00007ff813c8153d _DPSNextEvent + 927 17 AppKit 0x00007ff813c7fbfa -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394 18 Safari 0x00007ff91e16d8b5 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224 19 AppKit 0x00007ff813c722a9 -[NSApplication run] + 586 20 AppKit 0x00007ff813c46227 NSApplicationMain + 817 21 Safari 0x00007ff91e1581c0 SafariMain + 464 22 dyld 0x000000011583e51e start + 462 ) libc++abi: terminating with uncaught exception of type NSException MessageReceiveQueueMap::addImpl - adding duplicate any id receiver 35
Replies
2
Boosts
3
Views
1.6k
Activity
Feb ’23
SafariForWebKitDevelopment preferences crash, can't enable develop menu
I'm trying to run safari with a build of webkit that includes Atomics.waitAsync, and I can't enable the develop menu as the settings screen crashes. Is there a way to workaround this bug, by enabling the develop menu in the terminal? Or do I need to downgrade my MacOS version https://share.cleanshot.com/3Q5XFw kEventMenuPopulate to menu 'Safari' kEventMenuPopulate to menu 'Debug' 2022-12-04 16:28:38.903 SafariForWebKitDevelopment[13812:2325596] *** Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], NSMenuItem.m:467 2022-12-04 16:28:38.905 SafariForWebKitDevelopment[13812:2325596] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil' *** First throw call stack: ( 0 CoreFoundation 0x00007ff80f10141b __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff80ec4fe25 objc_exception_throw + 48 2 Foundation 0x00007ff80ffa3fb0 -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00007ff8121c08bc -[NSMenuItem initWithTitle:action:keyEquivalent:] + 363 4 Safari 0x00007ff9197fb5cd +[NSMenuItem(BrowserExtras) safari_menuItemForFileAtPath:] + 140 5 Safari 0x00007ff9196a1da0 -[GeneralPreferences _updateDownloadLocationMenu] + 158 6 libdispatch.dylib 0x00007ff80ee2c7fb _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x00007ff80ee2da44 _dispatch_client_callout + 8 8 libdispatch.dylib 0x00007ff80ee3a7b9 _dispatch_main_queue_drain + 952 9 libdispatch.dylib 0x00007ff80ee3a3f3 _dispatch_main_queue_callback_4CF + 31 10 CoreFoundation 0x00007ff80f0c7620 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x00007ff80f087ba0 __CFRunLoopRun + 2454 12 CoreFoundation 0x00007ff80f086b90 CFRunLoopRunSpecific + 560 13 HIToolbox 0x00007ff8189c76a6 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007ff8189c74b6 ReceiveNextEventCommon + 679 15 HIToolbox 0x00007ff8189c71f3 _BlockUntilNextEventMatchingListInModeWithFilter + 70 16 AppKit 0x00007ff8121ccf63 _DPSNextEvent + 909 17 AppKit 0x00007ff8121cbde4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219 18 Safari 0x00007ff919419253 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 224 19 AppKit 0x00007ff8121be423 -[NSApplication run] + 586 20 AppKit 0x00007ff812192457 NSApplicationMain + 817 21 Safari 0x00007ff9197c1e77 SafariMain + 464 22 dyld 0x00007ff80ec7c310 start + 2432 ) libc++abi: terminating with uncaught exception of type NSException zsh: abort ./SafariForWebKitDevelopment
Replies
0
Boosts
0
Views
1.8k
Activity
Feb ’23
file: XML and XSLT in WKWebView
Has anyone ever tried to use XML & XSLT in WKWebView, with the files included in the app bundle? I.e. example.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="transform.xslt"?> <page> </page> transform.xslt: <xsl:transform   version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="page"> <html> <body> <p>Hello World</p> </body> </html> </xsl:template> </xsl:transform> When I attempt to load that as file:///path/to/bundle/example.xml, I get a blank page (and nothing in the console). Various questions: I know that generally web console output inside apps doesn't appear in the logs, and there are various suggestions about injecting user scripts to fetch them by replacing e.g. console.log. But does that only fetch errors generated by Javascript, or does it also fetch other error messages? Should I be able to attach to my WKWebView's console from Safari on my Mac, over USB? If I try to view the same file using a file: URL in Safari on my Mac, I discover that security policy prevents a file: XML document from using a file: XSLT even if they are in the same directory; it considers all file: URLs to have different origins. I don't see that error with the WKWebView, hence question (1). Is there anything that I can do with WKWebView to permit access from a file: XML document to a file: XSLT document in the same directory, within the app bundle? I have tried using loadURL: allowingReadAccessToURL:, and that doesn't seem to work. I'm also aware of the WKSecurityOrigin type, and I wonder if I can use that to persuade WKWebView that the XML and XSLT are "same origin". Does this require that I implement a "content blocker"? Can a content blocker ever relax restrictions, rather than tightening them? Thanks for any suggestions!
Replies
0
Boosts
0
Views
841
Activity
Feb ’23
Receiver class org.openqa.selenium.safari.SafariDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract com.google.common.collect.ImmutableList createArgs()' of abstract class org.openqa.selenium.remote.ser
Hello, I am new to safari, and the safari web driver and I am trying to write a java program using selenium to open a web page.... import org.openqa.selenium.WebDriver; import org.openqa.selenium.safari.SafariDriver; // import org.openqa.selenium.Saf // I have not imported the following // import org.openqa.selenium.safari.SafariDriver; // because this does not provide me with the SafariDriver. public class Test_SafariDemo { // the purpose of this class is to test the Safari driver // Written by Michael John Little // Based on a Java program from... // https://www.browserstack.com/guide/run-selenium-tests-on-safari-using-safaridriver public static void main(String[] args) { // lets Instantiate a Safari driver class WebDriver drvr =null; try { drvr = new SafariDriver(); } catch (Exception e) { System.out.print(e); } // lets Launch the Google website drvr.navigate().to("http://www.google.com/"); // lets click on the search box and send a value drvr.findElement(By.id("lst-ib")).sendKeys("BrowserStack"); // click the search button drvr.findElement(By.name("btnK")).click(); //close the browser //drvr.close(); }// close public static void main(String[] args) } // public class Test_SafariDemo But I am getting the following [exception] message when I execute my code... Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.safari.SafariDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract com.google.common.collect.ImmutableList createArgs()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder. at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:358) at org.openqa.selenium.safari.SafariDriverService.createDefaultService(SafariDriverService.java:75) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:60) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:49) at Test_SafariDemo.main(Test_SafariDemo.java:25) Process finished with exit code 1 Any suggestions? Are there configuration options that I need to set when I instantiate the safariDriver class with?
Replies
1
Boosts
0
Views
1.4k
Activity
Feb ’23
Safari inspector problems with Element tab and Console
Hello, I have a problem with console, in Safari. In Safari for developers (tech. preview) i see more informations in console than in basic Safar (the blue one), but this things all just normal logs from console.log(), I see them before in Safari (blue one) before, but i did not see them now, can you try help me solve this out? Also I have a issue in Element tab, with the sidebar. I use the CSS tab, this is okay, but the marked one on the screenshot I don't have for time, but now it appears from nowhere and I don't know how to get rid of that. Thanks for help, I will be very happy if someone know hot to solve that, because Apple support doesn't help me so much.
Replies
0
Boosts
0
Views
790
Activity
Feb ’23
Connection drop with Safari/F5
We have an IIS website(ASP.net) that work at many location. We have a client where the website is hosted on IIS behind an F5(Big IP). When the client is connecting we have intermittent lost of connection. The issue arises more often with the Safari/Iphone. I have tried many things to find the issue but I'm running out of idea.Here is a Network trace gathered with Safari. You will see that I have many red lines that are requests that did not make it to the server. The requests for resources named 6-.ice are images while the 4-.ice are XHR requests: https://i.stack.imgur.com/lrIG7.png The XHR Request HTTP Status was 0. When it happens, we redirect the user to the BadRequest.htm page.I have validated the possible issue with HTTP/2 and connection HTTP header but everything is still on HTTP/1.Thank you!
Replies
1
Boosts
0
Views
1.1k
Activity
Jan ’23
Unable to play video in mac safari and iphone using HTML5 video tag
In my application which records the video from any device and saving in aws server, and admin can play recorded videos from any os/ device. After the ios updated on Dec 14 2022, my video component is messed up, I cannot record or play video from apple devices. As I cannot write entire project code, I have the code in the below link [https://github.com/amran-quantum/videoplayertesting/blob/main/index.html) This video is playing in mac chrome but NOT in mac safari and any of the iphone devices. I am struggling since 15 days.
Replies
0
Boosts
0
Views
1.3k
Activity
Jan ’23
Inspect WebView in Mac Application
Hello,What is the proper way to inspect a WebView in a Mac application?I can access any iOS simulator or connected device through the Safari Develop menu just not any Mac apps (The entry for the Mac lists "No Inspectable Applications").All the Mac apps are launched by Xcode and the scheme is set to debug.Is there something I am missing or are Mac apps not supported? I tried to search the documentation but found nothing.Thanks.
Replies
5
Boosts
0
Views
20k
Activity
Jan ’23
How to debug shared worker in Safari?
I am using Safari Technology Preview(16 version). With this version we can use Shared Worker, but how to debug it? For example, for Service Workers I see a separate menu item, but for Shared Workers I didn't find anything. Is there anyone who knows how to debug Shared Worker and see its logs?
Replies
1
Boosts
1
Views
2.3k
Activity
Jan ’23