Skip to content

Instantly share code, notes, and snippets.

@iamjason
Created July 2, 2024 23:07
Show Gist options
  • Save iamjason/94680dd8bc65b93dfebf3e4618e7784f to your computer and use it in GitHub Desktop.
Save iamjason/94680dd8bc65b93dfebf3e4618e7784f to your computer and use it in GitHub Desktop.
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment