gpt4 book ai didi

javascript - 如何在异步加载 Twitter 关注按钮时禁用屏幕名称

转载 作者:行者123 更新时间:2023-11-28 12:08:45 25 4
gpt4 key购买 nike

<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>

加载时,我需要它只显示关注按钮,而不是您关注的人的姓名。使用 iframe 时,您可以为 show_screen_name 添加查询参数。

我尝试这样做:

twitterWidgets.show_screen_name = false;

但是没有成功。有什么想法吗?

最佳答案

您可以使用 data-show-screen-name="false" 来完成此操作,如下所示:

<a href="http://twitter.com/twitterapi" class="twitter-follow-button" data-show-screen-name="false">Follow @twitterapi</a>

Twitter 对这个选项有一个特别说明:

Note that if you decide to set the show_screen_name parameter to false, you’ll still have to display “manually” which @username the Follow button is interacting with. In other words, it has to be very clear who the user is going to follow by clicking your Follow Button.

关于javascript - 如何在异步加载 Twitter 关注按钮时禁用屏幕名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6457504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com