Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Thanked 0 Times in 0 Posts

    Exclamation Replacing a flash file with a gif if no flash is detected

    I have found a bit of javascript that detects whether the user has flash or not and what version, but when I try to replace the flash file with a gif if they haven't got it nothing works.

    I've tried within the if statement:


    to change the source of the file to the gif.

    How do I target the flash file in my body tag, I've given it a name bannerFlash but it doesn't recognise it.

    Please can somebody help

  • #2
    Regular Coder
    Join Date
    Nov 2004
    The land of chocolate
    Thanked 16 Times in 16 Posts
    This is just a long shot, but how about using document.write to create the necessary html based on the if statement?
    if (user has flash) {
      document.write("<embed src=....");
    else {
      document.write("<img src=.....");
    Put this script in the body tag where the flash file or the image is supposed to come.

    Susie, if you want to see your doll again, leave $100 in this envelope by the tree out front. Do NOT call the police. You CANNOT trace us. You CANNOT find us.

    - Calvin.

  • #3
    Regular Coder
    Join Date
    Jul 2004
    mile high city
    Thanked 0 Times in 0 Posts
    Here's another method. I haven't used it myself but it might do what you need.

    Quote Originally Posted by ALA
    If you were to look at the source code of the home page at Macromedia.com, you’d see that they serve up an alternative image if the user can’t view Flash movies. They are detecting the Flash Player with JavaScript, and then using JavaScript to dynamically write out HTML based on the detection. Ugly, ugly, ugly. Here’s how I’d do it:

    <object type="application/x-shockwave-flash
    width="400" height="300">
    <param name="movie" 
    value="c.swf?path=movie.swf" />
    <img src="noflash.gif" 
    width="200" height="100" alt="" />
    If the browser doesn’t know how to play objects with a MIME type of application/x-shockwave-flash, it will simply go for the next child element and give that a try. I’m guessing that a simple image element should be okay for most people. Failing that, you can simply use text.
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts