Guest User

Untitled

a guest
Oct 17th, 2024
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html lang="en">
  4.  
  5. <head>
  6.  
  7. <meta charset="UTF-8">
  8.  
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10.  
  11. <title>JS vs No-JS Interface</title>
  12.  
  13. <script>
  14.  
  15. // JavaScript is enabled, load the enhanced interface
  16.  
  17. document.addEventListener("DOMContentLoaded", function() {
  18.  
  19. document.body.classList.add('js-enabled');
  20.  
  21. });
  22.  
  23. </script>
  24.  
  25. </head>
  26.  
  27. <body>
  28.  
  29.  
  30.  
  31. <!-- Content for JS users -->
  32.  
  33. <div id="js-interface" style="display:none;">
  34.  
  35. <h1>Enhanced Interface with JavaScript</h1>
  36.  
  37. <p>This content is shown to users with JavaScript enabled.</p>
  38.  
  39. </div>
  40.  
  41.  
  42.  
  43. <!-- Content for No-JS users and bots -->
  44.  
  45. <noscript>
  46.  
  47. <div id="no-js-interface">
  48.  
  49. <h1>Basic Interface</h1>
  50.  
  51. <p>This content is shown to users or bots with JavaScript disabled.</p>
  52.  
  53. </div>
  54.  
  55. </noscript>
  56.  
  57.  
  58.  
  59. <script>
  60.  
  61. // Make the JS interface visible when JavaScript is enabled
  62.  
  63. document.getElementById('js-interface').style.display = 'block';
  64.  
  65. </script>
  66.  
  67.  
  68.  
  69. </body>
  70.  
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment