Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Problem with 'spread the word' badge?

  • 6 trả lời
  • 34 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi AdeH

more options

I used the first (smaller vertical) badge at https://www.mozilla.org/en-US/plugincheck/ on my Wordpress blog but although it shows the badge, it also shows the second half of the HTML: "var pfsNextImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/safe.png";var pfsUpdateImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/upyourplug.png";" If I remove that part, it just shows the badge, but do I lose anything but not including the part I've removed?

The whole code is:

<a href="https://www.mozilla.org/en-US/plugincheck/"><img id="mozilla_plugin_checker_badge" src="https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/loading.png" width="180" height="150" alt="We can check your plugins and stuff" border="0" /></a><script type="text/javascript">var pfsNextImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/safe.png";var pfsUpdateImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/upyourplug.png";</script><script src="https://www.mozilla.org/js/plugincheck_badge.js"></script>
I used the first (smaller vertical) badge at https://www.mozilla.org/en-US/plugincheck/ on my Wordpress blog but although it shows the badge, it also shows the second half of the HTML: "var pfsNextImage = "https://www<i></i>.mozilla<i></i>.org/img/covehead/plugincheck/wb/en-US/180_150/safe.png";var pfsUpdateImage = "https://www<i></i>.mozilla<i></i>.org/img/covehead/plugincheck/wb/en-US/180_150/upyourplug.png";" If I remove that part, it just shows the badge, but do I lose anything but not including the part I've removed? The whole code is: <pre>&lt;a href="https://www<i></i>.mozilla<i></i>.org/en-US/plugincheck/"&gt;&lt;img id="mozilla_plugin_checker_badge" src="https://www<i></i>.mozilla<i></i>.org/img/covehead/plugincheck/wb/en-US/180_150/loading<i></i>.png" width="180" height="150" alt="We can check your plugins and stuff" border="0" /&gt;&lt;/a&gt;&lt;script type="text/javascript"&gt;var pfsNextImage = "https://www<i></i>.mozilla<i></i>.org/img/covehead/plugincheck/wb/en-US/180_150/safe.png";var pfsUpdateImage = "https://www<i></i>.mozilla<i></i>.org/img/covehead/plugincheck/wb/en-US/180_150/upyourplug.png";&lt;/script&gt;&lt;script src="https://www<i></i>.mozilla<i></i>.org/js/plugincheck_badge.js"&gt;&lt;/script&gt;</pre>

Được chỉnh sửa bởi cor-el vào

Tất cả các câu trả lời (6)

more options

That text is part of a script tag, so you shouldn't be seeing it.

Can you post a link to your blog site so we can check the code for errors?

Do you see any red text if you inspect the page source via the right-click context menu?

more options

Thanks for replying. My blog is at http://adeunsheep.wordpress.com/

You will see two versions of the badge on my blog, on the right sidebar. One is 'cleaned up' where I've removed the script tag (and the link seems to work fine), the other, further down, shows the badge with the whole text including the script tag.

Not sure what "inspect the page source" means but I've tried both 'view page source' and 'inspect element' on the text both on the Firefox page where I found the badge and on my blog (from within the widget placing area, on the blog itself logged in and logged out); 'view page source' shows red text, namely numbers preceded by a #, forward slashes (/), &amp, &gt,   (there's also a lot of blue and purple, and some bold black); 'inspect element' shows no red text.

As I say, I've found a workaround but figured it was worth pointing out. I must admit I don't understand how the link works without the script tag but then, I'm a complete novice where code of any sort is concerned!

more options

If you look at the page source then you will notice that the script tags are missing, so that text in now normal text and rendered as such.
So in this case there isn't an error in the text, but only the script tags got lost.
If you didn't do that then maybe the blog software did (removing unrecognized or not white-listed tags).

<li id="text-4" class="widget widget_text">
<h2 class="widgettitle">test</h2>
<div class="textwidget">
<a href="https://www.mozilla.org/en-US/plugincheck/">
 <img src="https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/loading.png" width="180" height="150" alt="We can check your plugins and stuff" border="0" />
</a>
<!-- this text should be in a script tag -->
var pfsNextImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/safe.png";
var pfsUpdateImage = "https://www.mozilla.org/img/covehead/plugincheck/wb/en-US/180_150/upyourplug.png";
</div>
</li>

Được chỉnh sửa bởi cor-el vào

more options

You're quire correct. I've just gone through the whole process again, made sure it says " </a><script type="text/javascript"> " before hitting save (on the wiget page of my WordPress blog), and lo and behold, when I hit save it removes it! Why? Guess that's a question for WordPress.

Thanks for your help, cor-el.

more options

Sorry that should have been "quite correct" !

more options

I've just visited WordPress's Help page for widgets and discovered that Javascript is not allowed as it can be used for malicious reasons. They allow it for YouTube and Google though as they are "trusted partners" - about time they made Firefox a trusted partner! Given that YouTube is owned by Google, I wonder if WordPress has some kind of special deal going with Google to disadvantage Firefox users?