Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how to add text alternative to JS incase scripts are disabled

Featured Replies

hi

 

IS there a way I can add an "alternative" thing to show as a fallback in case Javascript isn't enabled on a browser?

Kind of like when an image can not be displaced and you use alt="image ofmy dog" for example?

 

Specifically I use a Google Translate Tool on my website but being that some people disable scripts (mostly using Noscript) I want to show something in the place where the tool would normally be, e.g. text saying "you have Javascript disable, please enable to see the Google translate tool".

 

Thanks

hi

 

IS there a way I can add an "alternative" thing to show as a fallback in case Javascript isn't enabled on a browser?

Kind of like when an image can not be displaced and you use alt="image ofmy dog" for example?

 

Specifically I use a Google Translate Tool on my website but being that some people disable scripts (mostly using Noscript) I want to show something in the place where the tool would normally be, e.g. text saying "you have Javascript disable, please enable to see the Google translate tool".

 

Thanks

 

That's what the noscript tag is for:

 

<html>
<body>

<script type="text/javascript">
document.write("Hello World!")
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>

<p>A browser without support for JavaScript will show the text in the noscript element.</p>

</body>
</html>

  • Author

Hi

 

Is there a way to make a pop-up little window saying "You can't see the JS" when JS is disabled? Instead of putting this notice on the site's page?

 

Also, would you advise this, or are ALL popups annoying today?

Also, would you advise this, or are ALL popups annoying today?

 

Most browsers have built-in pop-up blockers, so traditional pop-ups are a bad idea. By traditional, I mean opening a new page/window/tab.

 

Showing an warning message via JavaScript (example) is not an option because JavaScript is disabled.

 

So the best solution is to show an obvious message within the page, near the top. You could highlight it with a coloured background and/or give it extra whitespace to help it stand out.

 

This is the message that Get Satisfaction shows when JavaScript is disabled:

 

110517182211-What-other-e-commerce-sites-are-using-MagicZoom-products-Mozilla-Firefox.png

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.