搜尋 Mozilla 技術支援網站

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

了解更多

embed flash is not displayed. But it appears after editing html with firebug.

  • 3 回覆
  • 12 有這個問題
  • 1 次檢視
  • 最近回覆由 luke.morton

more options

I have added a embed tag with a .swf file which reproduce a .flv video. The thing is that it works fine in all browser except Firefox. i tried to debug it using firebug, and what i found is, that aditing the embed using firebug without modifying the code just adding a space after the embed, the video start displaying.

I have added a embed tag with a .swf file which reproduce a .flv video. The thing is that it works fine in all browser except Firefox. i tried to debug it using firebug, and what i found is, that aditing the embed using firebug without modifying the code just adding a space after the embed, the video start displaying.

所有回覆 (3)

more options

Can you post a link to that web site or post a relevant part of the code?

more options

this is part of the code:


<object height="200" width="290" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="mediaPlayerIe">
	<param value="Player.swf" name="movie">
	<param value="high" name="quality">
	<param value="objectID=mediaPlayer&confFile=videoConf.xml&media=<data><type>video</type><file><![CDATA[my_video.flv]]></file><image><![CDATA[my_image.jpg]]></image></data>" name="FlashVars">
	<param value="#f4f4f4" name="bgcolor">
	<param value="true" name="menu">
	<param value="transparent" name="wmode">
	<param value="sameDomain" name="allowScriptAccess">
	<param value="true" name="allowFullScreen">
	<embed height="200" width="290" swliveconnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="sameDomain" menu="true" flashvars="objectID=mediaPlayer&confFile=videoConf.xml&media=<data><type>video</type><file><![CDATA[my_video.flv]]></file><image><![CDATA[my_image.jpg]]></image></data>" bgcolor="#f4f4f4" wmode="transparent" quality="high" id="mediaPlayerMz" src="Player.swf">
</object>

i hope this can help.

由 cor-el 於 修改

more options

I've run into a similar problem with YouTube videos which I've been able to fix with a Greasemonkey script. (Videos on the home page of YouTube lack a wmode attribute and Flash video renders as a grey box without it. I found that by adding wmode through Firebug the video would start to play.)

To get the script to work, I had to force to the browser to reload the element, which is what appears to happen when editing in in Firebug.

This affects me in Firefox 3.6 and 4.0 (Ubuntu Linux 10.04).

Greasemonkey script:

// ==UserScript==
// @name           YouTube fix
// @namespace      http://lukemorton.com.au
// @description    Set the wmode attribute for YouTube videos
// @include        http://www.youtube.com/watch*
// ==/UserScript==

var allEmbeds, thisEmbed;
allEmbeds = document.evaluate(
    "//embed",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);

for (var i = 0; i < allEmbeds.snapshotLength; i++) 
{
    thisEmbed = allEmbeds.snapshotItem(i);
    thisEmbed.setAttribute('wmode', 'opaque')
    thisEmbed.parentNode.replaceChild(thisEmbed.cloneNode(true), thisEmbed);
}


Whilst not particularly elegant, you could probably adapt this method to work for you. If you insert the script below after the embed it should work (note that I haven't tested this):

<script type="text/javascript">
var allEmbeds, thisEmbed;
allEmbeds = document.evaluate(
    "//embed",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);

for (var i = 0; i < allEmbeds.snapshotLength; i++) 
{
    thisEmbed = allEmbeds.snapshotItem(i);
    thisEmbed.setAttribute('wmode', 'transparent')
    thisEmbed.parentNode.replaceChild(thisEmbed.cloneNode(true), thisEmbed);
}
</script>


The above code will set wmode for all embeds in the document. If you'd rather target just the movie in your code, you could use this:

<script type="text/javascript">
thisEmbed = document.getElementById('mediaPlayerMz');
thisEmbed.setAttribute('wmode', 'transparent')
thisEmbed.parentNode.replaceChild(thisEmbed.cloneNode(true), thisEmbed);
</script>


Sorry about all the links, I couldn't find a way to disable them (<nowiki> doesn't seem to work).

Copying and distribution of this software, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

由 luke.morton 於 修改