Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scan HTML and javascript files for cross browser compatability?

I'm looking for a tool that will scan my HTML and JS files and report whether the scripts are cross browser compatible or not. I'm not really interested in an online tool which I have to enter all my URL's.

like image 307
jranaudo Avatar asked Jan 21 '23 23:01

jranaudo


2 Answers

There may be some "scanners" around but none of them is going to do a decent, complete job - whether things behave well across browsers one will have to confirm visually, using human eyes.

The best you can do in terms of automatic testing, in my opinion, is create valid HTML. It won't guarantee proper rendering, but it's a first step into the direction and will save you from many problems.

like image 86
Pekka Avatar answered Mar 01 '23 23:03

Pekka


You're not going to find such a tool unfortunately - if it existed, the person who made it would be able to pretty much charge whatever they liked for it and would be adored by web developers the world over!

In seriousness though, you can find tools such as W3C's HTML and CSS validators, but you will still have issues as different browsers do different things when presented with even the most valid standards-compliant markup. Valid markup does not mean it will look right, after all. You will often have problems with older browsers in this respect (read up on 'quirks mode' and 'standards mode').

Ensuring that the pages look the same in all browsers is quite hard, short of actually using each browser on each OS or platform you will not find a reliable way to do this automatically. I do believe that there are some tools out there to give you screenshots of a page loaded under various browsers, however I have heard they can be slow and aren't that brilliant.

As for JavaScript, all the browsers have their little quirks with it I have found. Even when using a framework such as jQuery or Prototype, you will still have issues which can only be found by trying the page out yourself and seeing if it does what you expect it to.

In essence, what I'm trying to say is that 'cross-browser support' is highly subjective and cannot be tested using an automated tool. Only you know what to expect from each page, which browsers are doing things 'right' and which ones aren't. This includes all aspects of the page, from HTML and CSS through to JavaScript.

I suspect that you really want a quick fix solution with minimal effort required, but you won't get it. You need to spend your own time and a lot of effort making sure your site looks and acts right across all the browsers you wish to support. No-one else will do it for you.

like image 41
Geoff Adams Avatar answered Mar 01 '23 23:03

Geoff Adams