JavaScript - Javascript Flash e imagen

 
Vista:

Javascript Flash e imagen

Publicado por masterdreams (1 intervención) el 09/02/2006 10:20:54
Muy buenas a todos.
Hay algún javascript que pueda sustituir un flash por una imagen en el casi de que el usuario no tenga instalado el pluging de Flash?
Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Javascript Flash e imagen

Publicado por Daniel Ulczyk (99 intervenciones) el 09/02/2006 18:42:58
Acá te dejo un script, si el mismo no detecta Flash instalado redirecciona a la página declarada en la variable

skipFlashURL


<script language="javascript">
<!-- Hide script from old browsers
var expireDate = new Date
var hasFlash = false
var numVisits = 0
var skipFlashURL = "noflash.html"
//Sets the browser cookie

function setCookie(){

expireDate.setMonth(expireDate.getMonth() + 6)

document.cookie = "numVisits=" + 0 + "; expires=" + expireDate.toGMTString()

}

//Check for flash if browser is netscape
//submitted to www.a1javascripts.com by Joshua Luft-Glidden
if(navigator.appName == "Netscape"){

for(i=0; i<navigator.plugins.length; i++){

if(navigator.plugins[i].name == "Shockwave Flash"){

hasFlash = true

}

}

}

//Check for flash if browser is IE

else if(navigator.appName == "Microsoft Internet Explorer"){

document.writeln("<script language='VBscript'>")
document.writeln('\'Test to see if VBScripting works')
document.writeln("detectableWithVB = False")
document.writeln("If ScriptEngineMajorVersion >= 2 then")
document.writeln(" detectableWithVB = True")
document.writeln("End If")
document.writeln('\'This will check for the plugin')
document.writeln("Function detectActiveXControl(activeXControlName)")
document.writeln(" on error resume next")
document.writeln(" detectActiveXControl = False")
document.writeln(" If detectableWithVB Then")
document.writeln(" detectActiveXControl = IsObject(CreateObject(activeXControlName))")
document.writeln(" End If")
document.writeln("End Function")
document.writeln("</scr" + "ipt>")
hasFlash = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.1")

}

//If there is no cookie (first time visitor) set one

if(document.cookie == ""){
setCookie()
}
//If there is a cookie (visitor has been here before) update cookie

else{

var dummy = document.cookie.split("=")

numVisits = dummy[1]
expireDate.setMonth(expireDate.getMonth() + 6)
document.cookie = "numVisits=" + ++numVisits + "; expires=" + expireDate.toGMTString()

}
//If visitor has been to the site many times skip flash intro

if((document.cookie != "") && (numVisits > 5) && hasFlash){

document.location = skipFlashURL

}
//If visitor doesn't have flash skip intro

if(!hasFlash){

document.location = skipFlashURL

}
//End script hiding -->

</script>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar