Skip to content

Instantly share code, notes, and snippets.

@iamjason
Created July 2, 2024 23:07
Show Gist options
  • Select an option

  • Save iamjason/94680dd8bc65b93dfebf3e4618e7784f to your computer and use it in GitHub Desktop.

Select an option

Save iamjason/94680dd8bc65b93dfebf3e4618e7784f to your computer and use it in GitHub Desktop.

Revisions

  1. iamjason created this gist Jul 2, 2024.
    19 changes: 19 additions & 0 deletions second.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Second Page</title>
    </head>
    <body>
    <h1>This is the second page</h1>
    <script>
    if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.notification) {
    window.webkit.messageHandlers.notification.postMessage("Hello from the second page!");
    console.log("window.webkit.messageHandlers.notification is sent");
    } else {
    console.error("window.webkit.messageHandlers.notification is undefined");
    }
    </script>
    </body>
    </html>