5

How to dynamically add wmode="opaque" to already displaying embed elements? Without reloading the elements, the embedded content should not lose its state.

Just setting the wmode attribute with javascript doesn't work.

Removing the element and then adding it again makes wmode take effect, but the flash element loses its state, among other problems. E.g if it's a video player its position/playback status resets. So that solution is no good.

Any other way of displaying content over the embedded element is acceptable as well.

(I'm doing this trough a content script in a Chrome extension if that is of any help.)


This is not a duplicated of How to dynamically add wmode=transparent to Youtube embed code? as there the parameter is added to a frame and not directly to the element it self.

Community
  • 1
  • 1
Qtax
  • 31,392
  • 7
  • 73
  • 111
  • I'm not sure that you can. Is there a problem with doing this as soon as the page loads? Or does that not help your extension? – Brad Mar 17 '12 at 04:14
  • @Brad, the extension is only invoked when user clicks a button (some time after a page has loaded), so I'd hope to avoid running content scripts and modifying pages where the user does not want to use the extension (most pages). (And in case dynamic `embed`s are created on the page at some time before the user invokes the extension, they would have to be tracked and altered, not sure if that's easy to do.) – Qtax Mar 17 '12 at 04:19
  • @Qtax have you seen this: http://stackoverflow.com/questions/534474/changing-arbitrary-flash-objects-wmode-to-transparent – Dagg Nabbit Mar 17 '12 at 04:21
  • @GGG, doesn't `wrap()` remove and readd the element? – Qtax Mar 17 '12 at 04:23
  • @Qtax no idea, I don't use jQuery. Does removing the element from the DOM and re-adding it reset the plugin? – Dagg Nabbit Mar 17 '12 at 04:24
  • @GGG, it does in my tests (as said in the question in the first place). – Qtax Mar 17 '12 at 04:27
  • @Qtax I see it now. I seriously doubt this will work. The wmode attribute makes flash render in completely different ways... as a separate window or as part of the document, in the screen buffer or via the GPU, etc. Transitioning smoothly between those rendering modes would be quite a trick. Not saying Adobe couldn't have allowed for it, but I doubt this kind of thing is really a priority for them. – Dagg Nabbit Mar 17 '12 at 04:32
  • @Qtax is this for YouTube, though? There's any easy fix if so. Just asking because you linked another YouTube related post... – Dagg Nabbit Mar 17 '12 at 04:38
  • @GGG, not really, could be any site. – Qtax Mar 17 '12 at 06:37

2 Answers2

0

It is possible but a bit tricky. If you don't mind using jQuery here is a nice way written by Jose Nobile http://www.nobilesoft.com/Scripts/fix_wmode2transparent_swf.js

If you want to stick to js then you can try something like shown here http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/

Hope it helps!

Reinaldo
  • 4,186
  • 3
  • 21
  • 23
0

iframe masks out the part of the flash it's over, allowing other elements to display over it. At least in Chrome.

This is what YouTube uses for their play list bar (at the bottom of the view port).

Qtax
  • 31,392
  • 7
  • 73
  • 111
  • Could you expand your answer a little bit? Currently, there's no clear relationship between your question and answer (` – Rob W Feb 27 '13 at 15:28
  • @RobW, the goal was to display something over an embedded flash object (with the criteria in the question). Using an ` – Qtax Feb 27 '13 at 18:06