Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.



Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.


Flash and Browser Detection

Flash and Browser Detection

Enable Flash Installed (Y/N) and browser as conditions

Beginner Modder
3 Posts
Administrator has disabled public posting

Re: Flash and Browser Detection

Hi Ken,

there is some code available in the recipes for browser detection. I do also want to build some of these in to the product, so next year you'll start to see some bigger changes in MetaMod that help to manage all the different types of rules that people want to use. (e.g. there are scores of different combinations of pages in VIrtueMart that people want to target, so the interface needs to be able to handle this without becoming confusing and cluttered with too many options).

Regarding Flash detection:

The basic problem is that I don't think there's any direct way for the web server to know if flash is installed, based on the HTTP request that it gets from the client.
There are some ways that you can use Javascript to detect if Flash is installed, then get JS to send an HTTP request through to the server with the info about Flash encoded into it. You could then store that info in the user's session and use it to control MetaMeta. See http://www.adobe.com/products/flashplay … ction_kit/ for the JS required to do the detection.

However there's a flaw in that -- the *first* page that the user requests has to be assembled in Joomla before a script can be run on the browser, to alert Joomla that there's flash (or not). Therefore, you can't use MetaMod to base module selection on Flash detection, on the very first page that a client requests.

So... what you would have to do would be to put some kind of Javascript redirect on the first page they request, that first checks for Flash, then redirects the page to the same URL plus "&noflash=1", only if Flash was not found. (or maybe vice versa).

So then MetaMod could detect that variable, and if found it would put it in the session, and then would not have to add the javascript check to each subsequent page, and would know what to do with the module.

To summarise:

- MetaMod checks the session for a flag about whether to prevent Flash.
- If it finds it, it displays alternative module. End.
- MetaMod checks the URL parameter "noflash"
- If it finds it, adds "noflash" to the session and displays appropriate non-flash module. End.
- At this point, MetaMod hasn't got any info in the session, and hasn't received any notification in the URL. So...
- MetaMod adds a Javascript to the page, something like this quasi-code:
if (FlashNotInstalled() ) {
  redirectToPage("<?php echo $my_current_url; ?>&noflash=1"
- And, MetaMod automatically includes the module that requires Flash.
-- if Flash was enabled, then it's going to work normally, and display the Flash module
-- if Flash was not enabled, then the page will redirect, and next time round MetaMod won't need to output the JavaScript, and it will automatically output the non-Flash-based module.

Other considerations:
- what happens when JS is not enabled? In that case you have no way of detecting if Flash is enabled, at all.

Hope that helps to get you started. The devil is in the details of the JS snippet above. You need to construct that redirection URL properly (not like I did it above), and use the correct code for doing the redirection, and for determining whether Flash is installed.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

3330 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
Total Topics:
Total Polls:
Total Posts:
Total Posts Today:
User Info:
Total Users:
Newest User:
Members Online:
Guests Online:

There are no members online

Forum Legend:

 New Sticky