Jump to content

Detect HTML5 & JavaScript Availability HTML4?


JeZxLee
 Share

Recommended Posts

Detect HTML5 & JavaScript Availability HTML4?

 

Hi,

 

I would like to detect if HTML5 and JavaScript are available using HTML4.

Can someone help me with the above?

My website requires both HTML5 and JavaScript so I would like to print an error message using HTML4...

 

Thanks!

 

JeZxLee

Link to comment
Share on other sites

Hello!

 

HTML4 and 5 are actually a whole spectrum of technologies that blur into one another.

That means you can't detect "HTML4" or "HTML5" as a single thing.

 

What I usually do is detect for WebGL.

There are a few ways to do that:

 

http://stackoverflow.com/questions/11871077/proper-way-to-detect-webgl-support

 

If a browser can do WebGL, it's a nice modern browser that contains most of important HTML5 things that we game developers like.

Link to comment
Share on other sites

With regard to Javascript, I think the standard thing to do is to wrap your error message complaining it is disabled it in the noscript tag and make sure this is displayed clearly when it scripting is disabled. You can also use scripting to show HTML elements used by your game or even programmatically create your elements such as your canvas so that nothing but the error shows if scripting is not enabled.

NB: The noscript tag ensures that search engine bots etc. don't mistake the javascript disabled message for the page's main content when indexing (you don't want someone that searches for your game to see the javascript message in their search engine)

 

With regard to detecting whether HTML5 is supported, I think you could do this from your HTML 5 page (assuming Javascript is not disabled) by checking if the browser is in quirks mode which it will presumably use if it does not recognize the HTML5 doctype. Googling quirks mode detection suggests document.compatMode might be a property to check.

 

As D13 suggests you also should test for (or handle failure to create) the HTML5 technologies you intend to use for your game. But probably don't test for WebGL unless you need it IMHO.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...