Does anyone else hide JS from older browsers?

Does anyone else use the old

<!-- hide JS from old browsers --> 

trick?

As far as I remember, this was intended for people who used Netscape, or IE4.

I just looked at our statistics, and last month we had more people visiting the site using "Playstation Portable" (4 visits) as our user agent than we used Netscape (1 visit).

Do I have a moment, even having a β€œhide” in my javascript?

+7
source share
4 answers

No, you don’t have to do this anymore.

Crockford also says ...

Do not use the <!-- //--> script with scripts. It is designed to prevent the appearance of scripts in the form of text in the first-generation browsers Netscape 1 and Mosaic. This has not been necessary for many years. <!-- //--> should signal HTML comment. Comments should be ignored, not compiled and executed. Also, HTML comments do not include -- , so a script that has a decrement has an HTML error.

+13
source

Not. {add extra characters here to fit the limit for SO}

+3
source

As I understand it, if you are developing an application, one of the main selling points of which is javascript-based interactivity, it makes no sense to serve old browsers.

However, it is important to know the specific goals of your product. You need to know who you are targeting and make an informed decision about whether or not to do it.

In any case, you should try to find out if the browser is included in javascript, and if not, let them know why your site is down.

+2
source

Yes, and you too. Drupal does this as follows:

 <script type="text/javascript"> <!--//--><![CDATA[//><!-- ... //--><!]]> </script> 
-2
source

All Articles