DISQUS

The Disqus Blog: Wordpress/Disqus Valid XHTML

  • symtym · 1 year ago
    I've tried to fix this, but it keeps giving an invalid XHTML:

    <script type="text/javascript">
    (function() {
    var links = document.getElementsByTagName('a');
    var query = '?';
    for(var i = 0; i < links.length; i++) {
    if(links[i].href.indexOf('#disqus_thread') >= 0) {
    links[i].innerHTML = 'View Comments';
    query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
    }
    }
    document.write('<script type="text/javascript" src="http://disqus.com/forums/symtym/get_num_replies.js' + query + '"><' + '/script>');
    }());
    </script>

    The problems lines are:
    for(var i = 0; i < links.length; i++) {

    Corrected < with &lt;

    query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';

    Corrected with &

    document.write('<script type="text/javascript" src="http://disqus.com/forums/symtym/get_num_replies.js' + query + '"><' + '/script>');

    Couldn't figure the problem out

    TIA
  • Andrew G. Allen · 1 year ago
    Also interested in a fix.
  • digitalJE5U5 · 1 year ago
    Valid HTML > disqus

    Do the programmers read any of this?
  • Daniel Ha · 1 year ago
    Yes, we are fixing this.

    In the meantime:
    http://humani.st/fix-disqus-validation-errors-o...
  • naterkane · 1 year ago
    the end of line 191 in the plug needs to have the closing anchor removed. and that did it for me.

    if i could figure out how to paste code in here without it doing weird stuff, i would.
  • Ricardo Martins · 1 year ago
    document.write isn't allowed in XHTML. This means no disqus threads in the article/blog post if you serve your XHTML as aplication/xhtml+xml (as recommended).