Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

[Howto] Open Safari Web Controller

Camilo edited this page May 22, 2022 · 1 revision

Safari Web Controller is needed for example when you need to support Apple Pay. Unless you implement the native SDK you must use Safari Web Controller. Normal WKWebViews for iOS do not support Apple Pay.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <button id="safariwc">Open Safari Web Controller</button>
    
    <script type="text/javascript">
        const button = document.getElementById("safariwc");
        button.addEventListener('click', event => {
            // Configure your desired url
            $agent.trigger("opensafari", {
                url: 'https://www.google.com'
            });
        });
    </script>
</body>
</html>
{
    "$jason": {
        "head": {
            "title": "Reload webpage on pull",
            "actions": {
                "opensafari": {
                    "type": "$href",
                    "options": {
                        "view": "web",
                        "url": "{{$jason.url}}"
                    }
                }
            }
        },
        "body": {
            "style": {
                 "border": "rgba(0,0,0,0)"
            },
            "background": {
                "type": "html",
                "url": "file://index.html",
                "options": {
                   "pull": true
                },
                "action": {
                      "type": "$default"
                }
            }
        }
    }
}
Clone this wiki locally