Adding a Google +1 Button after page load in IE 8

前端 未结 1 1625
广开言路
广开言路 2021-01-13 18:13

I\'m working on a site right now where I need to build a URL before putting the button on the page. Here\'s how it works:

var googleplus = $(\"

        
相关标签:
1条回答
  • 2021-01-13 18:59

    Here is the solution, it works for me in both IE7/8:

    var gPlusOne = document.createElement('g:plusone');
    gPlusOne.setAttribute("size", "tall");
    gPlusOne.setAttribute("href", "http://google.com");
    container.appendChild(gPlusOne);
    

    it appears that using innerHTML to insert a <g:plusone></g:plusone> element into a page does not work in IE7/8, Create the g:plusone element directly like this: document.createElement('g:plusone'). see more: http://www.google.com/support/forum/p/Webmasters/thread?tid=3d63228b915dab32

    0 讨论(0)
提交回复
热议问题