搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Problem with 'spread the word' badge?

  • 6 回覆
  • 34 有這個問題
  • 2 次檢視
  • 最近回覆由 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>

由 cor-el 於 修改

所有回覆 (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>

由 cor-el 於 修改

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?