Jump to content

Pass Javascript Flash Detection variable to php


John_A

Recommended Posts

Cross posted with [url=http://www.phpfreaks.com/forums/index.php/topic,119081.0.html]this thread[/url], hope the mods don't mind!

I need to have a PHP variable for flash installed (e.g. $hasFlashSupport='true'), I know I can't actually use PHP for the flash detection, but I've used [url=http://blog.deconcept.com/swfobject]swfobject[/url] before for this (the flash detection) without any problems.

What I need to know how to do is take the flash / noflash variable from swfobject and put this as a session variable in PHP. Unfortunately the only thing I know less of than PHP is Javascript :(

I can't actually use swfobject to display the flash / noflash content, as swfobject assumes you want to actually display a flash movie if it's found, when I actually want to show alternative content (i.e. a link to a flash microsite), for example: -
[code] if ($hasFlashSupport=='true')
{
    //visitor has flash installed
    echo "<a href='flashpages.php'>Flash content</a>";
} else {
    //visitor doesnt have flash installed
    echo "<a href='noflash.php'>HTML content</a>";
}[/code]

I want to place a check in the header of every page, something like: -

If (php session variable $hasFlashSupport isn't set) {
  detect flash with swfobject
  write php session variable
  }

I think it needs a modified version of swfobject.js, which would write a php sessions variable, but I don't even know if that's possible, much less how to go about doing it!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.