Page refresh with limit [closed]

0

Possible some form of a script that updates the page in a limited way? example I have the script update a page only 10 times and then for is it possible?

    
asked by anonymous 28.01.2017 / 18:44

1 answer

3

Clarify a little more what you need, but an example is possible in javascript:

    var vezes = 2;

    var  conta = window.location.href;
    conta = conta.split("conta=");

    if(conta.length > 1){
        var num = conta[1];

        redireciona(num);
    }else{
        redireciona(1);
    }

    function redireciona(num){
        if(num == 'NaN' || num == ''){
            num = 1;
        }
        if(num <= vezes){
            alert('redirecionamento '+num+ ' de '+vezes);
            window.location = "?conta="+(eval(num)+1);
        }

    }
    
29.01.2017 / 02:32