beeware / beeware/toga

Javascript disabled over HTTP in WebView on macOS

Open
#3,614 20 comments 0 reactions 0 assignees View on GitHub
enhancement macOS
Dominant language
Python
Stars
5.4k
Forks
829
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

After using the Positron design pattern (WebView widget paired with HTTP server running on another thread to serve assets to the web view), I was puzzled that none of the Javascript worked, but only when I built the macOS app and ran it. Everything was fine when running the application in dev mode.

After some hunting, I discovered this Stack Overflow answer: https://stackoverflow.com/a/62537163
It explains that I need to add to the project's Info in Xcode a dictionary called "App Transport Security Settings" with a key called "Allow Arbitrary Loads" set to `YES`. Once I manually added this to the Xcode project, everything worked fine.

### Describe the solution you'd like

It would be useful to call out this issue on the WebView documentation page. Additionally, I couldn't tell if there was a persistent way to add this Info setting in the `pyproject.toml` for my Briefcase app. Since I had to open Xcode to manually add this setting, I assume the setting will be lost if Briefcase ever needs to regenerate the Xcode project.

### Describe alternatives you've considered

The alternative I found was to add the setting manually with Xcode after generating the project with Briefcase and hope it isn't overwritten in the future.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the WebView documentation page and the Briefcase app's pyproject.toml and generated Xcode project mentioned in the report. Check how the macOS Info setting is represented after regeneration. Done means the docs explain the HTTP/WebView JavaScript requirement and clearly state how to persist the setting, or what manual Xcode step remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
build-system, desktop, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.