Forum du clan Vioc

Clan [Vioc] - Geriatric Gaming Club since A.D. MMIII - [Vioc] Parkinson nous fait cliquer plus vite, Alzheimer nous fait oublier le résultat.
It is currently 26 Jun 2025 20:38

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Y'a du Roxxor en Javascript parmi vous ?
PostPosted: 26 Apr 2013 14:15 
Offline
Ténardier
User avatar

Joined: 07 Oct 2003 18:52
Posts: 9975
Location: Dans les entrailles du Forum
Yop les amis.

J'ai un petit script à faire pour le site de mon boulot, mais je pige que dalle à Java, carrément rien de rien :oops:

Mon besoin : vous arrivez sur une page qui doit déterminer si vous avez Acrobat Reader d'installé, si oui elle vous re-dirige de façon transparente vers la page 2, sinon elle vous alerte et vous propose d'installer le lien via un popup d'alerte et au click vous envoie vers la page de téléchargement chez Adobe.

j'ai trouvé le script qui permet de déterminer si Acrobat est disponible ou pas sur la machine, mais je ne sais pas comment le modifier pour les liens.
En fait il utilise juste une variable "lib" qui est soit "vide" soit "non" pour répondre à la question donc pas assez aboutie dans mon cas...

Voilà le code :

Code:
<html>
<head>
<title>Test si Acrobat Reader est installé</title>
<OBJECT     type="application/pdf"
            style="display:none"
            id="PDF"></OBJECT>
</head>
<body>
<script type="Text/JavaScript">
    var lib="non ";
    try        {    document.getElementById("PDF").LoadFile('');
                    lib="";
                }
    catch(e)    {    if ( navigator.plugins && navigator.plugins.length > 0 )
                    {    for ( noPlug=0; noPlug < navigator.plugins.length; noPlug++ )
                       {    if ( navigator.plugins[noPlug].name.indexOf("Adobe Acrobat") >= 0 )
                         {    lib="";
                                break;
                            }
                        }
                        }
                   }
    alert("Acrobat Reader "+lib+"installé");
</script>
</body>
</html>


D'après-vous je peux le modifier comment ?
Merci !

_________________
Image
[Vioc] Parkinson me fait cliquer plus vite, Alzheimer me fait oublier le résultat.


Top
 Profile E-mail  
 
 Post subject: Re: Y'a du Roxxor en Javascript parmi vous ?
PostPosted: 26 Apr 2013 19:01 
Offline
Old Of Warcraft
User avatar

Joined: 09 Oct 2003 10:20
Posts: 5374
Location: Grenoble
SI tu rajoutes un test a la fin ca devrait marcher. (j'ai aussi enlevé l'espace dans var lib="non")

Code:
<html>
<head>
<title>Test si Acrobat Reader est installé</title>
<OBJECT     type="application/pdf"
            style="display:none"
            id="PDF"></OBJECT>
</head>
<body>
<script type="Text/JavaScript">
    var lib="non";
    try        {    document.getElementById("PDF").LoadFile('');
                    lib="";
                }
    catch(e)    {    if ( navigator.plugins && navigator.plugins.length > 0 )
                    {    for ( noPlug=0; noPlug < navigator.plugins.length; noPlug++ )
                       {    if ( navigator.plugins[noPlug].name.indexOf("Adobe Acrobat") >= 0 )
                         {    lib="";
                                break;
                            }
                        }
                        }
                   }
if ( lib == "non" ) {
    alert("Acrobat Reader pas installé");
    window.location = "http://www.adobe.com";
} else {
     window.location = "mapage2.php";
}

</script>
</body>
</html>

_________________
la meilleure signature du fofo, et de loin !


Top
 Profile E-mail  
 
 Post subject: Re: Y'a du Roxxor en Javascript parmi vous ?
PostPosted: 06 May 2013 14:07 
Offline
Ténardier
User avatar

Joined: 07 Oct 2003 18:52
Posts: 9975
Location: Dans les entrailles du Forum
Cool !
Merci Oll je tente ça !

...désolé du temps mort, j'étais au pays ;)

_________________
Image
[Vioc] Parkinson me fait cliquer plus vite, Alzheimer me fait oublier le résultat.


Top
 Profile E-mail  
 
 Post subject: Re: Y'a du Roxxor en Javascript parmi vous ?
PostPosted: 07 May 2013 9:30 
Offline
Ténardier
User avatar

Joined: 07 Oct 2003 18:52
Posts: 9975
Location: Dans les entrailles du Forum
ça maaaaaarche !
Merci Oll ! :ouichef:

_________________
Image
[Vioc] Parkinson me fait cliquer plus vite, Alzheimer me fait oublier le résultat.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group