最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is it important for a page to be standards compliant even if it works fine? - Stack Overflow

programmeradmin0浏览0评论

I have a html page that has more than one head and body. The first body says "loading" before the rest of the head with javascript and the other body loads. The javascript then deletes the first body before showing the whole document.

My friend told me this is not standards compliant. But the page works fine on Internet Explorer and in Firefox too.

Is it actually important to be standards compliant if the page works fine?

~~ edit ~~

thanks for all the help, i'll make it standards compliant like suggested.

I have a html page that has more than one head and body. The first body says "loading" before the rest of the head with javascript and the other body loads. The javascript then deletes the first body before showing the whole document.

My friend told me this is not standards compliant. But the page works fine on Internet Explorer and in Firefox too.

Is it actually important to be standards compliant if the page works fine?

~~ edit ~~

thanks for all the help, i'll make it standards compliant like suggested.

Share Improve this question edited May 13, 2011 at 0:11 captainandcoke asked May 12, 2011 at 23:21 captainandcokecaptainandcoke 1,1153 gold badges13 silver badges17 bronze badges 1
  • Multiple heads? You chopped one of and more grew back? Sounds familiar. And a good reason! – Rudie Commented May 13, 2011 at 0:16
Add a comment  | 

7 Answers 7

Reset to default 10

I recommend being standards compliant for the following reasons:

  1. If a page is standards compliant, your browser doesn't have to do unspeakable voodoo to try and get your page to render. People like faster page loads
  2. Which also includes Google Bot. If Google Bot doesn't have to tear its robotic hair out it becomes happier. While there are other things that need to be taken into consideration, it's good to have this base covered
  3. When you're dealing with DOM manipulation through JavaScript, non compliant html/xhtml sometimes produces weird results that lead to an annoying amount of time spent debugging

Think of it like duct-taping your broken car muffler. Sure it works now, but for how long? Web standards are there for a reason, and browsers follow them the best they can. If you follow the standards, then you can be assured that your site will work for quite a while. If not, you might be relying on some bug or quirk in the browser, which might get fixed and leave your site looking like garbage.

Follow the standards; you won't regret it.

Depends on what you're concerned with. If your site works on the browsers you are concerned with then hey, it works!

Still, being standards compliant has some benefits:

  • Future Proof: Your site will work several years from now.
  • Accessibility: New browsers and browser updates probably aren't going to break your site (without warning!)
  • SEO: Facilitating search engine spiders as they index your site will allow more pages/content to be added to search results.
  • Feel good about yourself: Sticking to standards makes me feel warm inside. :)

Still its up to you. What's important to you?

It's important. If you designed your page to be standards compliant, then it's possible, or even likely, that your pages will still work in browsers and devices 20 years from now. Otherwise, it's more and more likely that they won't. Make it future proof. A second reason, is a non-standards-compliant code may cause problems in areas you hadn't considered. For example, being standards compliant may in one go, make it possible to: print the documents without modification, have it accessible to users with a range of disabilities and so on. In fact, many websites designed with standards compliance in mind were never intended for mobile devices, but because they were designed to be standards compliant, when devices were made to show standards compliant websites, those old sites work without any changes.

Standards compliance are a way to "guarantee" your site is going to be displayed the way you intended in every browser that follows the mentioned standards (ever heard of Internet Explorer 6, 7, not the case).

Mind you that some people (visually impaired for example) use special browsers that rely on standards compliance. Please have them in consideration, standards are needed especially in that case.

It depends of your requirements. You should ask yourself if compliance is important for your current project. But it's not hard to conceive situations where it really just doesn't matter. So, if your realize your current project wouldn't benefit in anyway undergoing modifications to make it standard compliant, just don't waste your time. But if you do see some benefits the compliance should bring, even though you should still evaluate whether the work needed really worths the benefits. It' best if you are not dogmatic about these subjects.

More often than not, if I come up with a solution that is not standards compliment, my solution is almost always hard to understand for others, buggy and based on my limited knowledge of web development. Then in shame but with hope, I drop my solution and continue searching for a better one.

发布评论

评论列表(0)

  1. 暂无评论