Streamlit app showing up blank in Safari

This app shows up blank in Safari but works in other browsers: ki.uos.de
Here is the code. The start.py script is the one not loading properly.

The Safari versions we have tested: 16.5.1, 17.2.1

with the latest version of streamlit

There was a similar issue previously but it’s closed so I opened a new one since it appears it’s a persistent problem with some users. But maybe it’s something I did wrong and not a bug? I think it’s a bug since other browsers work fine. But we also tested some other streamlit apps in the same Safari browsers and they worked so it’s not for every Streamlit app apparently.

2 Likes

Did you find a solution? Mine also is showing blank of any browser on iphone.

My script also wouldn’t open in Safari, and am aware of ongoing issues since Safari can be finicky due to its strong emphasis on security, privacy, and its unique JavaScript engine. Checking these areas could help diagnose and resolve the problem.

  1. WebSockets and Protocols: Streamlit relies on WebSockets for real-time communication, and Safari has historically been more stringent about which WebSocket protocols it supports. If Safari is blocking these, the app may fail to load or run correctly.

  2. Cross-Origin Resource Sharing (CORS): Safari has strict security policies regarding cross-origin resource sharing. If resources such as your web fonts or external scripts are being loaded from different origins without proper CORS headers, Safari might block these requests which could break the app.

  3. Blocking Third-Party Cookies: Safari’s Intelligent Tracking Prevention (ITP) can sometimes inadvertently block third-party cookies and scripts that are necessary for functionality. If your Streamlit app requires third-party components (like gTTS, requests, or even some internal state mechanisms), this could be a problem.

  4. Service Workers/Caching Issues: Safari’s handling of service workers and its caching mechanisms can sometimes cause issues. While Streamlit doesn’t use service workers by default, any embedded HTML or dynamic content could be affected.

  5. JavaScript Engine Differences: Safari uses the WebKit engine for rendering pages, which may interpret JavaScript differently compared to other browsers. Certain JavaScript functions or modern features might not be fully supported or could behave differently.

Here are some options to try:

  • Websockets: Ensure that Safari supports the WebSockets implementation you are using. Sometimes disabling and enabling WebSockets in the developer settings can solve issues.

  • CORS: Verify that any external resources being accessed (like fonts from Google Fonts or APIs) have the appropriate CORS headers set.

  • Third-Party Cookies: Check if your app interacts with any third-party APIs that might be blocked by Safari’s privacy settings.

  • Check JavaScript Compatibility: Make sure that the JavaScript and CSS you are using are fully compatible with WebKit.
    Hope you get it right, or perhaps this may help someone else. Mine is working again :slight_smile: