Created
October 10, 2025 20:44
-
-
Save dynamicguy/9b678e0841848d5ad644c549d6ab99d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Purchase Button Popup</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| text-align: center; | |
| margin-top: 100px; | |
| background-color: #f8f9fa; | |
| } | |
| button { | |
| background-color: #007bff; | |
| color: white; | |
| border: none; | |
| padding: 12px 24px; | |
| font-size: 16px; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| transition: background-color 0.3s; | |
| } | |
| button:hover { | |
| background-color: #0056b3; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <button id="purchaseBtn">Purchase</button> | |
| <script> | |
| document.getElementById("purchaseBtn").addEventListener("click", () => { | |
| const popup = window.open( | |
| "https://www.google.com", // URL to open | |
| "purchasePopup", // Popup name | |
| "width=800,height=600,top=150,left=300,resizable=yes,scrollbars=yes" | |
| ); | |
| if (!popup || popup.closed || typeof popup.closed === "undefined") { | |
| alert("Popup blocked! Please allow popups for this site."); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment