Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Oct 2005
    Location
    Delhi
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    detect flash with PHP for users where javascript is disabled

    Code:
    <?
    // Search through the HTTP_ACCEPT header for the Flash Player MIME type.
    if (strstr($_SERVER['HTTP_ACCEPT'], 'application/x-shockwave-flash'))
    {
      $hasFlash = true;
    }
    
    if ($hasFlash)
    {
      require('flash.html');
    } else {
      require('noflash/index.html');
    };
    
    ?> 
    
    But it does not work for Safari Mac
    
    Adobe's Flash detection kit pdf has to say something about this:-
    
    "The following issues with server side detection should be closely noted. Internet Explorer on Mac OS is hard-coded to accept '*/*' and cannot be modified dynamically. Secondly, users can manually uninstall Flash Player by deleting the executable itself. This casuses the custom accept header to be “orphaned” such that server detection logic thinks Flash has been installed, when in fact it is no longer available. It is also possible to disable ActiveX controls through the Windows XP Service Pack 2 security settings, which will similarly cause the custom accept header to be orphaned."
    
    So is there any foolproof way to detect flash with PHP (for users who have javascript disabled) ?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I think it would better if you put a small flash file on the nonflash page that redirects the user to the flash page using actionscript inside of the flash. If no redirection occurs well then obviously something is preventing them from the flash.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <noscript>
    You must have JavaScript enabled!
    </noscript>
    That's cheating though.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    More people have flash disabled than Javascript and anyone with flash should certainly have javascript.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New Coder
    Join Date
    Oct 2005
    Location
    Delhi
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks Aerospace-you are too good

    That did the trick
    Thanks
    aerospace

    For All:

    I have just used a small width/height:1/1 flash where i have just written
    getURL("flash.html") (which will redirect to my flash file)

    else

    <meta http-equiv="refresh" content="2;URL=noflash/index.html">

    Code:
    <html >
    <head>
    </head>
    <body>
    
    <meta http-equiv="refresh" content="2;URL=noflash/index.html">
    
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1" height="1" border="0" >
      <param name="movie" value="detectflash.swf" />
      <param name="quality" value="high" />
      <embed src="detectflash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed>
    </object>
    
    </body>
    </html>
    detectflash.swf contains only getURL("flash.html")
    Last edited by sugata_bhar; 02-07-2007 at 06:45 AM. Reason: correct wrong code


  •  

    Posting Permissions

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