简体   繁体   中英

Twitter Button not showing up in IE9

Hello Stackoverflow Community,

I'm currently facing an awkward problem with the twitter follow button I'm trying to integrate into a webpage. In every browser except IE9 my twitter button is showing up. In IE9 it sometimes does and sometimes not.

<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo constant('TWEET_LINK');?>" data-text="<?php echo constant('TWEET_TEXT');?>" data-count="none" data-hashtags="<?php echo constant('TWEET_HASHTAG');?>">Tweet</a>           
<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>    

What could cause this problem?

use jslint on this javascipt to se that ! is not valid. Remove ! from start of it and make it pass jslint.

I don't want to start flamewar but simply use semicolons helps a lot with IE

function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");

should be ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM