Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 526959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:49:55+00:00 2026-05-13T08:49:55+00:00

I am trying to create an interface to the swfobject found at http://code.google.com/p/swfobject/ .

  • 0

I am trying to create an interface to the swfobject found at http://code.google.com/p/swfobject/. I am building the needed alternate content for when the user does not have flash player installed. This is working fine in FF, but not in IE for some reason. I have done this the same way a million times before and it has always worked, I can not figure out why I am getting this error this time.

Basically, when the page loads, it calls a function $.SWFObject.embedSWF() which builds the alternate content, and calls the swfobject.embedSWF function. The alternate content is built with a ready function like the following.

When the setupAlternateContent function is called the error occurs at the (‘#’ + containerID).

embedSWF: function(flashFilename, containerID, width, height, minFlashVersion, flashvars, params, attributes) {
   //If the flashvars, params, or attributes variables were passed in and are objects, then save them, otherwise they will be empty.
   settings.flashvars = (flashvars && typeof(flashvars) == 'object') ? flashvars : {};
   settings.params = (params && typeof(params) == 'object') ? params : {};
   settings.attributes = (attributes && typeof(attributes) == 'object') ? attributes : {};

   //Setup the alternate content that will be used if the user does not have flash installed
   $(document).ready(function() { setupAlternateContent(containerID); });

   //Call the embedSWF function which is found in the swfobject core file
   swfobject.embedSWF(flashFilename, containerID, width, height, minFlashVersion, flashUpdater, settings.flashvars, settings.params, settings.attributes);
}

function setupAlternateContent(containerID) {
    //Create the innerContainer div element
    var innerContainer = $.create('div', {
    }).appendTo('#' + containerID).css({
        font: '18px Arial, Verdana, sans-serif',
        height: '130px',
        width: '240px',
        paddingTop: '35px',
        margin: '0px auto'
    });

    //Put the flash image inside the innerContainer
    $.create('img', {
        src: SWFOBJECT_FOLDER_LOCATION + 'flash_icon.png',
        alt: 'Install Flash'
    }).appendTo(innerContainer).css({cursor: 'pointer'}).click(function() { window.location = 'http://get.adobe.com/flashplayer'; });

    //Add a message bellow the flash icon
    $.create('p', {}, 'Install Adobe Flash Player').appendTo(innerContainer);
}

IE does not like the (‘#’ + containerID) argument which does not make any sense because i have done this before without problems. Also, I am using jQuery DOMEC extension which is where the $.create comes from.

Any help is appreciated. Thanks!

Metropolis

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:49:55+00:00Added an answer on May 13, 2026 at 8:49 am

    You may want to rethink your approach. If you need to display JS-generated alternate content when Flash Player is not available, I suggest doing a swfobject.hasFlashPlayerVersion("9") check before attempting to create the alt content. This check can be performed before the DOM loads.

    Note that swfobject.embedSWF is wrapped in its own domready-style event, and therefore doesn’t need to be wrapped in jQuery’s $(document).ready event.

    Simple example:

    var hasFlash = swfobject.hasFlashPlayerVersion("9");
    if(hasFlash){
       swfobject.embedSWF( ... ); 
    } else {
       //Create alt content right away (no need to wait for dom to load)
       var altcontent = setupAlternateContent();
       //When DOM is ready, append alt content to page
       $(document).ready(function () { altcontent.appendTo("mycontainer") });
    }
    

    This approach speeds things up (no sitting around waiting for DOM to load just to figure out what needs to be done), and also prevents the alt content from being generated if it isn’t needed.

    Following this logic, I’d refactor your code to something like this (please forgive any typos):

    embedSWF: function(flashFilename, containerID, width, height, minFlashVersion, flashvars, params, attributes) {
    
       if(swfobject.hasFlashPlayerVersion(minFlashVersion)){
    
          //If the flashvars, params, or attributes variables were passed in and are objects, then save them, otherwise they will be empty.
          settings.flashvars = (flashvars && typeof(flashvars) == 'object') ? flashvars : {};
          settings.params = (params && typeof(params) == 'object') ? params : {};
          settings.attributes = (attributes && typeof(attributes) == 'object') ? attributes : {};
    
          //Call the embedSWF function which is found in the swfobject core file
          swfobject.embedSWF(flashFilename, containerID, width, height, minFlashVersion, flashUpdater, settings.flashvars, settings.params, settings.attributes);
    
        } else {
    
           //Create alt content right away (no need to wait for dom to load)
           var altcontent = setupAlternateContent();
    
           //When DOM is ready, append alt content to page
           $(document).ready(function() { altContent.appendTo(containerID); });
    
        }
    
        function setupAlternateContent(containerID) {
    
            //Create the innerContainer div element
            var innerContainer = $.create('div').css({
                font: '18px Arial, Verdana, sans-serif',
                height: '130px',
                width: '240px',
                paddingTop: '35px',
                margin: '0px auto'
            });
    
            //Put the flash image inside the innerContainer
            $.create('img', {
                src: SWFOBJECT_FOLDER_LOCATION + 'flash_icon.png',
                alt: 'Install Flash'
            }).appendTo(innerContainer).css({cursor: 'pointer'}).click(function() { window.location = 'http://get.adobe.com/flashplayer'; });
    
            //Add a message bellow the flash icon
            $.create('p', {}, 'Install Adobe Flash Player').appendTo(innerContainer);
    
            return innerContainer;
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 373k
  • Answers 373k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Make three height:100% divs (col1, col2, col3) that reach from… May 14, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer Two controls to look into: 1. Expander (this could work,… May 14, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer I would not go the route of instantiating 45 forms… May 14, 2026 at 7:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.