Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: redirect

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2000
    Messaggi
    1,175

    redirect

    esiste un modo + elegante per fare un redirect del:
    codice:
    <meta http-equiv="refresh" content="2;URL=http://sito.it/index1.html">

  2. #2
    Questo dovrebbe essere compatibile cn tutti i browser. Esistono TANTISSIMI redirect..te ne dico uno a caso! tieni conto che esiste il semplice location.href, cmq.

    NELL'HEAD:

    codice:
    <script language="JavaScript1.2">
    
    var duration=2;
    
    var message = "";
    
    var font_size = 2;
    
    var font_face = "verdana";
    
    var NS6redirection = "http://sito.it/index1.html";
    
    var bar_width = 0;
    
    var bar_height = 0;
    
    var centered = (screen.width) ? (screen.width-bar_width)/2 : 0;
    
    function postaction(){
    window.location="http://sito.it/index1.html"
    }
    
    var clipright=0
    var widthIE=0
    var widthNS=0
    
    function initializebar(){
    if (document.all){
    baranchor.style.visibility="visible"
    widthIE=bar.style.pixelWidth
    startIE=setInterval("increaseIE()",50)
    }
    if (document.layers){
    widthNS=document.baranchorNS.document.barbackgroundNS.clip.width
    document.baranchorNS.document.barNS.clip.right=0
    document.baranchorNS.visibility="show"
    
    startNS=setInterval("increaseNS()",50)
    }
    }
    
    function increaseIE(){
    bar.style.clip="rect(0 "+clipright+" auto 0)"
    window.status=""
    if (clipright<widthIE)
    clipright=clipright+(widthIE/(duration*20))
    else{
    window.status=''
    clearInterval(startIE)
    postaction()
    }
    }
    
    function increaseNS(){
    if (clipright<202){
    window.status=""
    document.baranchorNS.document.barNS.clip.right=clipright
    clipright=clipright+(widthNS/(duration*20))
    }
    else{
    window.status=''
    clearInterval(startNS)
    postaction()
    }
    }
    window.onload=initializebar
    </script>
    NEL BODY:

    codice:
    <script language="JavaScript1.2">
    if(document.layers){
    document.write('<font size='+font_size+' face="'+font_face+'">' +message+ '</font>
    ');
    document.write('<ilayer name="baranchorNS" visibility="hide" width='+bar_width+' height='+bar_height+'>')
    document.write('<layer name="barbackgroundNS" bgcolor=black width='+bar_width+' height='+bar_height+' z-index=10 left='+centered+' top=0></layer>')
    document.write('<layer name="barNS" bgcolor=blue width='+bar_width+' height='+bar_height+' z-index=11 left='+centered+' top=0></layer>')
    document.write('</ilayer>')
    }
    else if (document.all){
    document.write('<font size='+font_size+' face="'+font_face+'">' +message+ '</font>');
    document.write('<div id="baranchor" style="position:relative;width:'+bar_width+'px;height:'+bar_height+'px;visibility:hidden;">')
    document.write('<div id="barbackground" style="width:'+bar_width+'px;height:'+bar_height+'px;z-index:9"></div>')
    document.write('<div id="bar" style="width:'+bar_width+'px;height:'+bar_height+'px;z-index:10"></div>')
    document.write('</div>')
    }
    else if (document.getElementById){
    document.write('<font size='+font_size+' face="'+font_face+'">' +message+ '</font>');
    document.write('<META http-equiv="REFRESH" CONTENT="'+duration+';URL='+NS6redirection+'">')
    }
    </script>

  3. #3
    Utente di HTML.it L'avatar di *Ray*
    Registrato dal
    Oct 2000
    Messaggi
    495
    100 righe di codice per un redirect ?


  4. #4
    Originariamente inviato da *Ray*
    100 righe di codice per un redirect ?

    :master: Scusa...allora perkè non utilizzi quello che hai inserito in alto?????????????? nel tuo primo messaggio???? Cosa intendi x "elegante" ??


  5. #5
    codice:
    <script language="JavaScript">
    
    location.href="http://sito.it/index1.html"
    
    </script>


    nell'head!

  6. #6
    Utente di HTML.it
    Registrato dal
    Sep 2000
    Messaggi
    1,175
    Originariamente inviato da PiccoloPalazzi
    codice:
    <script language="JavaScript">
    
    location.href="http://sito.it/index1.html"
    
    </script>


    nell'head!
    c'è un modo per temporizzare il tutto... ad es eseguire il location dopo n secondi?

  7. #7
    Nel Primo script che ho scritto, bastava editare:

    var duration=2;

    dove 2, sono i secondi.

    Nel Primo che hai scritto tu, bisogna editare:

    content="2

    Nell'ultimo che ho scritto, no.

    PS: MA XKE' NON UTILIZZI LO SCRIPT CHE HAI SCRITTO TU??? CHE E' UNA POTENZA?!?!!?

  8. #8
    codice:
    <html>
    <head>
    <script language="JavaScript">
    location.href="http://www.prova.it"
    </script>
    </head>
    </html>
    Raga, ho questo script per il redirect, soltanto che ho notato che la scritta nella barra di navigazione non si aggiorna.
    Esiste un altro semplicissimo codice come questo, o una piccola aggiunta per far sì che si aggiorni anche la barra di navigazione?

  9. #9
    Utente di HTML.it L'avatar di gizax
    Registrato dal
    Jan 2004
    residenza
    Rome
    Messaggi
    386
    il meta tag refresh non è consigliato dal w3c

    meglio usare l'http redirect

    http://www.w3.org/QA/Tips/reback

  10. #10
    Gizax, grazie per il link, però ad esempio:

    http://httpd.apache.org/docs-2.1/en/....html#redirect

    Ok, mi ha spiegato cos'è. Ma come si applica??? Cosa devo fare per ottenere un HTTP Redirect?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.