W3C home > Mailing lists > Public > www-validator@w3.org > July 2015

Google Searchbox Not Validating as HTML5

From: Julian P <cool.classic.cb@gmail.com>
Date: Tue, 30 Jun 2015 23:21:48 +0000 (UTC)
To: www-validator@w3.org
Message-ID: <loom.20150701T011526-5@post.gmane.org>
Hi!  I have added the Google searchbox to my HTML5 site. When I go to the
W3C validator I get an error: 'element gcse:search not allowed as child of
element div in this context'. I was instructed by Google to put the script
in a div, and cannot get the searchbox to work without it. My code is below.
Many thanks!  Julian

<div id="searchbox">    
    <script>
       (function() {    
            var cx = '014531685129972083622:vk5kxnojpx0';    
            var gcse = document.createElement('script');    
            gcse.type = 'text/javascript';    
            gcse.async = true;    
            gcse.src = (document.location.protocol == 'https:' ? 'https:' :
'http:') + '//www.google.com/cse/cse.js?cx=' + cx;

            var s = document.getElementsByTagName('script')[0];

            s.parentNode.insertBefore(gcse, s);

        })();

    </script>    
    <gcse:search> </gcse:search>    
 </div>
Received on Wednesday, 1 July 2015 16:22:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:13 UTC