Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect Flash Else Show JPEG 2

Status
Not open for further replies.

bluesauceuk

Programmer
Jan 1, 2001
73
GB
Hi!

I am devloping a site aimed at doctors, healthcare workers - who mainly work in hospitals.

I want to be able to use flash... if they have it... but if not show a JPG in it's place..

We need to avoid the download flash - as in healthcare there is an awful lot of security inside hospital networks.

Network managers DO NOT want to allow "people" to download plugins... but we the PRIMARY FOCUS.. is that if they have it... they see the flash.swf else showflash.jpg and that's it.

It is important to note that this must happen on ONE PAGE - no hidden transparent flash movies.

It just needs to be fairly simple and resonably accurate.

PC and MAC platform too...

Can anyone help?

Thanks a million - and I give good stars if the answer is what I need!

Thanks again,


BS
 
first of all, put this in the appropriate sections of your page:
Code:
<script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;>
<!--
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf(&quot;Flash&quot;)!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf(&quot;Director&quot;)!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) 
  {
  no flash!!!
  }
  else
  {
  has flash!!!
  }
}
//-->
</script>
</head>

<body onLoad=&quot;MM_checkPlugin('Shockwave Flash','has%20flash','no%20flash',false);return document.MM_returnValue&quot;>

that should detect if there is a flash plug-in or not.

in the sections with the !!! you can either put dhtml code there to show the jpg or the swf, or you can do use page redirections.

Hope this helps


biggie



ps: the detection code is from dreamweaver, i just edited it a bit. if that doesnt work, dont hold me responsible, hehehe. I think it is cross-browser so it should work.


The Man of Tomorrow is forged by his battles today.
 
How do you write in the sections with the !!! you can either put dhtml code there to show the jpg or the swf, or you can do use page redirections.

for the idiots like me who dont know how??

if (!ok)
  {
  url.page1.htm
  }
  else
  {
  url.page2.htm
  }
}
//-->
</script>


is this how???

idaryl
idface.gif
 
idaryl,

I think as for now that is best. just redirect the page to another appropriate page. You do get the idea.


biggie



The Man of Tomorrow is forged by his battles today.
 
doit like this:

Code:
document.location.href='NameOfPage.htm';



biggie




The Man of Tomorrow is forged by his battles today.
 
Ooops

what about this part? ......

<body onLoad=&quot;MM_checkPlugin('Shockwave Flash','has%20flash','no%20flash',false);return document.MM_returnValue&quot;>

what does the &quot;%&quot; stand for? and also the statement &quot;has%flash&quot; &quot;no%flash&quot; mean? do I leave this alone or what - I cant find a reference to it in the script....

idaryl
idface.gif
 
use this instead:

Code:
<script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;>
<!--
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf(&quot;Flash&quot;)!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf(&quot;Director&quot;)!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}
//-->
</script>





<body onLoad=&quot;MM_checkPlugin('Shockwave Flash','hasflash.htm','noflash.htm',true);return document.MM_returnValue&quot;>

replace hasflash.htm and noflash.htm with your pages appropriately.

biggie





The Man of Tomorrow is forged by his battles today.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top