javascript - Changing innerHTML of script tags in IE for loading google plusone button explicitly -


to add google's plusone button on website following script tag inserted (for explicit load).

<script type="text/javascript" src="https://apis.google.com/js/plusone.js">   {"parsetags": "explicit"} </script> 

it looks pretty straight forward in html. wan't insert script using js file. use following code:

var e = document.createelement('script'); e.src = "https://apis.google.com/js/plusone.js"; e.id = "googplusonescript"; e.innerhtml = '{"parsetags": "explicit"}'; document.getelementsbytagname("head")[0].appendchild(e); 

it works pretty awesome in browsers except ie because ie doesn't allow write innerhtml of script tags. anywork arounds ? (i have jquery inserted in page. can use jquery too.)

came across same issue. under ie should use script.text = '{"parsetags": "explicit"}'; instead of script.innerhtml


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -