Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    replace dopo caricamento pagina

    Buongiorno a tutti!
    Ho trovato in giro il seguente codice che apre 5 finestre o tab e dentro ci carica delle pagine. Ogni X secondi aggiorna il tab mostrando una nuova pagina. Le pagine sono specificate all'interno del file HTML stesso.
    Il problema è che carica le nuove pagine anche se le vecchie pagine non hanno finito il caricamento. Io vorrei invece che caricasse la nuova pagina solo quando quella vecchia ha finito di caricarsi. Soluzioni?
    Grazie!

    codice:
    <html>
    
    <head><Title>Start Visits</title>
    <font size="5"> Ready : Page Visitor
    </font>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Expires" content="0" />
    <meta name="keywords" content="No Robot" />
    <meta http-equiv="Content-Language" content="fr">
    <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript">
    var site = new Array();
    var i = 0;
    var j = 0;
    var nb = 0;
    var nbv = 1 ;
    var nbf = 5 ; // nb de fenetres
    var fenetre = new Array();
    var duree = 6000 ;	// TEMPO PER CIASCUNA SCHEDA
    var timer ;
    var xhr ;
    if(duree < 3000) { duree = 3000 ; }
    if(nbf > 10) { nbf = 10 ; }
    if(nbf < 0) { nbf = 1 ; }
    var lll = 250 ;
    
    //LISTA DEI SITI DA VISITARE
    site[0] = new Array("http://www.youtube.it");
    site[1] = new Array("http://www.google.it");
    site[2] = new Array("http://www.html.it");
    site[3] = new Array("http://www.virgilio.it");
    site[4] = new Array("http://www.yahoo.it");
    site[5] = new Array("http://www.sun.com");
    site[6] = new Array("http://www.w3c.org");
    site[7] = new Array("http://www.ieee.org");
    
    function validation() {
    
    if (window.XMLHttpRequest) {
    xhr = new XMLHttpRequest(); // FF et autre
    } else if (window.ActiveXObject)  {
    xhr = new ActiveXObject("Microsoft.XMLHTTP");   // IE
    }
    
    xhr.onreadystatechange  = function() {
    if(xhr.readyState == 4) {
    if(xhr.status == 200) {
    document.getElementById("visu_cit").innerHTML = xhr.responseText ;
    } else {
    document.getElementById("visu_cit").innerHTML = "Errore " + xhr.status ;
    }
    }
    };
    }
    
    function openPage() {
    if(nb < lll) {
    if(fenetre[0] != null && !fenetre[0].closed) {
    fenetre[0].location.replace(site[nb]) ;
    } else {
    fenetre[0] = window.open(site[nb]);
    }
    nb++;
    nbv++;
    for(i=1;i<nbf;i++) {
    if(nb < lll) {
    if(fenetre[i] != null && !fenetre[i].closed) {
    fenetre[i].location.replace(site[nb]) ;
    } else {
    fenetre[i] = window.open(site[nb]);
    }
    nb++;
    }
    }
    
    timer = window.setTimeout("openPage() ;", duree, "JavaScript");
    document.getElementById("visu_cit").innerHTML = "
    
     "+(lll-nb)+" exchanges
      "+Math.round((lll-nb)/nbf*duree/1000)+"  secondes
    </p>" ;
    top.document.title=''+(lll-nb)+' vist. '+Math.round((lll-nb)/nbf*duree/1000)+' sec.' ;
    } else {  // fin des ouvertures
    timer = window.setTimeout("fenetre[0].close();", 3000, "JavaScript");
    
    document.getElementById("visu_cit").innerHTML = "
    
     Done</p>" ;
    top.document.title=' Done' ;
    
    for(i=1;i<nbf;i++) {
    if(fenetre[i] != null && !fenetre[i].closed) {
    fenetre[i].close();
    }
    }
    document.getElementById("visu_cit").innerHTML = "<h3>Visits done.</h3>  
     
    ";
    var repmass = function(param1,param2,param3,param4) {
    Params = 'link='+param1+'&type='+param2+'&lng='+param3+'&contrib='+param4+'';
    new Ajax.Updater('visu_cit','mnmass.php',{method:'GET',parameters:Params});
    }
    repmass('gip.cipcip','AUT','com','INT');
    document.getElementById("infostop").innerHTML = "<a href=\"http://www.mysite.it/share.php\"> Next. </a> 
    ";
    }
    if(nbv > 20) { // validation des échanges
    nbv = 1 ;
    validation() ;
    }
    }
    
    function verifierEchange() {
    // détecter un anti pop-up
    var popuptest1 = window.open("Windows Test1","W1","directories=no,height=10,width=10, menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
    if (!popuptest1) {
    document.getElementById("visu_cit").innerHTML = "
    
    POP-UP can't appears.
    "
    +"If you use popup blocking software you need to disable it before visiting page.  <a href=\"javascript:openPage()\">ici</a></p>" ;
    alert("If you use popup blocking software you need to disable it before visiting pages. ");
    } else {
    popuptest1.close();
    document.getElementById("visu_cit").innerHTML = "
    
     "+lll+" exchanges 
     During "+Math.round(lll/(nbf*duree)/1000)+" sec. 
     Parameters : "+duree/1000+"s between "+nbf+" windows.</p>" ;
    openPage() ;
    }
    
    }
    window.onload = verifierEchange();
    </script>
    </head>
    
    <body>
    Visiting page for you...
    
    
    
    <div id="visu_cit">
    <input type="button" value="Visiting" onClick="javascript:openPage();" tabindex="1">
    </div>
    
    <div id="infostop"></div>
    
    </body>
    </html>

  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    Non ho controllato tutto lo script, ma da quello che ho capito carica siti esterni, se cosi fosse alla domanda:
    Il problema è che carica le nuove pagine anche se le vecchie pagine non hanno finito il caricamento. Io vorrei invece che caricasse la nuova pagina solo quando quella vecchia ha finito di caricarsi. Soluzioni?
    Nessuna, non puoi interagire su siti esterni e capire (in javascript) quando la pagina e completamente caricata.
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3
    ok, grazie, ma per curiosità, con cosa potrei effettuare questo controllo?

  4. #4
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    lato server, utilizzando il proxy, prova a fare una ricerca qui o sul forum del linguaggio server che usi. Ma ne so il giusto, pertanto non sono neanche sicuro che funzioni.
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

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.