flex - How to redirect to an HTML page if Flash is not installed? -


i want in flex app redirect html page if user doesn't have flash installed. noticed in html generated flash has:

        <div id="flashcontent">             <p>                 view page ensure adobe flash player version                  10.0.0 or greater installed.              </p>             <script type="text/javascript">                   var pagehost = ((document.location.protocol == "https:") ? "https://" :    "http://");                   document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"                                  + pagehost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='get adobe flash player' /></a>" );              </script>          </div> 

which displays generic message not having flash.

i know can put html there displayed if flash doesn't exist don't want load html if it's not need (case when flash installed) thought best way redirect html page if flash doesn't exist.

how in flex?

you won't able in flex, since application won't loaded if user doesn't have correct flash player version. best bet modify index.template.html file. haven't specified version of flex you're using, template file might different between versions 4 , 3.

flex 3 had following js code detect whether or not user has flashplayer version:

// version check flash player has ability start player product install (6.0r65) var hasproductinstall = detectflashver(6, 0, 65);  // version check based upon values defined in globals var hasrequestedversion = detectflashver(requiredmajorversion, requiredminorversion, requiredrevision);  if ( hasproductinstall && !hasrequestedversion ) { 

//sniped

} else if (hasrequestedversion) { 

//sniped

} else {  // flash old or can't detect plugin 

and it's @ last else you'd want insert js code redirect, like:

window.location.replace('otherpage.html'); 

your template file should have similar this.

more on js redirects - http://andylangton.co.uk/articles/javascript/javascript-redirect-scripts/

flex 4

first disable express install project properties -> flex compiler under html wrapper. warning: overwrite html-template folder, modifications on files lost. should confirmation popup when that.

then open html-template/swfobject.js in text editor. go line 693 - should under "show alternative content" else in function embedswf - , comment , add, or replace with:

window.location.replace('http://mydomain/noflash.html'); 

do clean build after save file.

this straightforward way of doing it. there's more elegant way don't modify swfobject.js index.template.html instead, requires bit more code written.

please note there settings under flex compiler overwrite html-template folder, undoing changes files within.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -