Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts

    Chronic validators, how do you validate errors from social media buttons?

    My site is totally validated, except for 13 errors and 2 warnings caused by the code provided to me by Facebook and Twitter for their "Like" and "Follow" buttons. How do you validation die-hards get around this?

    http://www.urlgone.com/ee2144/

  • #2
    New Coder
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I don't think you're going to like the answer. You don't have control over social plugins at all. So you can't edit their code to successfully validate it.

    To be honest, I'd take the validation results with a grain of salt. So long as you don't commit any major crimes, all those CSS errors and "divs don't belong here" don't really hurt anything.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You could cheat by adding the social media code from JavaScript so that it gets added after you do your validation - provided you are using HTML and not XHTML.

    That doesn't make their garbage into HTML but it does at least get rid of the errors relating to their garbage from the HTML that you are validating (which is effectively that part of your page that isn't their code).

    Google provide a valid variant for their +1 links, with Facebook their like link is valid HTML and just needs a / added if you are using XHTML. The Twitter tweet button has two invalid attributes but the rest is valid.

    With XHTML the invalid garbage would stop the page displaying so you would have to rewrite their code to be valid in order to use it.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •