Show message if JavaScript is disabled

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
itauthor
Propeller Head
Posts: 32
Joined: Wed Jul 23, 2008 7:51 am
Location: Oxford, UK
Contact:

Show message if JavaScript is disabled

Post by itauthor »

With HTML5 output, if Javascript is disabled only the outer frame loads, leaving a big empty box on screen. The inner contentBody div is not filled, so I can't see any obvious way of putting some simple text onto the page to suggest to the user that they might like to enable Javascript.

If I could access the HTML of the outer frame of the HTML5 page I'd like to put something like this in it:

Code: Select all

<noscript>
      <div style="margin-top: 2em;text-align:center">
           <span style="font-size:40px;color:red">JavaScript is not enabled!</span>
      </div>
</noscript>
(well, maybe a little more subtle - but you get the idea).
This would show up when Javascript was disabled, but not be displayed the rest of the time.

I'm not overly concerned that the HTML5 output doesn't degrade gracefully without Javascript, but it would be nice to be able to explain to users who are using Javascript-disabled browsers why they're not seeing anything.

I'm sure this is too obvious an issue not to have an obvious solution - or at least be a question that's been answered before - however, despite looking through the Flare help and attempting to search this forum, I've failed to find out what I need to do to show such a message. It would have been nice if Madcap had built in a message into the HTML5 output as an editable default. Or maybe there is such a thing but it's just not working for me.

If anyone can shed any light on this I'd be very grateful to hear from you.
Paulie
Sr. Propeller Head
Posts: 140
Joined: Sun Mar 01, 2015 3:01 pm

Re: Show message if JavaScript is disabled

Post by Paulie »

Hi there,

As a quick test, I added the following to the <div id="contentBodyInner"> element of the Default.htm file in the Output folder:

Code: Select all

<p id="javascriptWarning" style="font-size:40px;color:red">Javascript is not enabled.</p>
<script>
	document.getElementById("javascriptWarning").style.display = "none";
</script>
If JavaScript works, the paragraph is hidden. If JavaScript is disabled, the paragraph stays visible.
"In an ideal world, software should be simple, well designed, and completely intuitive to end users. In the real world, good documentation is king."
Post Reply