<!DOCTYPE html>

<html>

<head>

    <title>PDF DeepLink Redirect</title>

</head>

<body style="background: #f0f0f0; text-align: center; padding-top: 50px;">

    <h1>Leite zur Vorschau weiter...</h1>

    <p>Bitte bestätigen Sie die Ausführung des lokalen Skripts.</p>

    <script>

        // Lese Parameter aus der URL (z.B. ?pdf=...&page=...&opener=...)

        const params = new URLSearchParams(window.location.search);

        const pdfPath = params.get('pdf');

        const pageNum = params.get('page');

        const openerPath = params.get('opener');


        if (pdfPath && pageNum && openerPath) {

            // Erstellen der lokalen applescript:// URL

            const scriptURL = `applescript://com.apple.scripteditor?script=${openerPath}&param1=${pdfPath}&param2=${pageNum}`;


            // Umleitung zur lokalen Ausführung (Safari/Browser wird den Befehl ausführen)

            window.location.replace(scriptURL);

        } else {

            document.body.innerHTML = "Fehler: Parameter fehlen im DeepLink.";

        }

    </script>

</body>

</html>