How to fix flash object z-index

If any of your html element is getting hide behind the flash object such as youtube video player, or any flash player/object

Then you should call this function on body load.

function fix_flash_z_index() {
// loop through every embed tag on the site
var embeds = document.getElementsByTagName(’embed’);
for (i = 0; i < embeds.length; i++) { embed = embeds[i]; var new_embed; // everything but Firefox & Konqueror if (embed.outerHTML) { var html = embed.outerHTML; // replace an existing wmode parameter if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i)) new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'"); // add a new wmode parameter else new_embed = html.replace(//i))
new_object = html.replace(//i, ““);
// add a new wmode parameter
new_object = html.replace(/<\/object\>/i, “\n“);
// loop through each of the param tags
var children = object.childNodes;
for (j = 0; j < children.length; j++) { try { if (children[j] != null) { var theName = children[j].getAttribute('name'); if (theName != null && theName.match(/flashvars/i)) { new_object = new_object.replace(//i, ““);
catch (err) {
// replace the old embed object with the fixed versiony
object.insertAdjacentHTML(‘beforeBegin’, new_object);

Example to call this function
$(document).ready(function () {

3 thoughts on “How to fix flash object z-index”

  1. It’s hard to find your blog in google. I found it
    on 18 spot, you should build quality backlinks , it will help you to rank to google top 10.
    I know how to help you, just type in google – k2 seo tips and tricks

  2. I read a lot of interesting posts here. Probably you spend a lot of time writing, i
    know how to save you a lot of work, there is an online tool that creates
    high quality, SEO friendly articles in minutes, just search in google – laranitas free content source

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.