Jquery history.go (-1); Chrome does not work

1

I've even done some research here on stackoverflow about creating a back button. The situation is that I click on a dynamic record to edit, then I have the option to cancel (which is to go back) in IEca and FF works, but in chrome we have problem.

I have tried other alternatives, but nothing worked does not work.

<button type="submit" name="voltar" value="voltar" id="voltar" class="btn btn-default" style="margin-left: 30px">Cancelar</button>


    $('#voltar').click(function() {

        history.go(-1);
        return false;
    });

I've tried something straight inline also in JS, but it did not! Any solution?

SOLUTION: Apparently what I did to make sure was just taking the jquery that was at the bottom of the page and play at the beginning of it. You will understand.

    
asked by anonymous 29.04.2015 / 20:07

1 answer

2

I ran a test with your code as follows from Chrome and it worked normally:

<button type="submit" name="voltar" value="voltar" id="voltar" class="btn btn-default" style="margin-left: 30px">Cancelar</button>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script><script>$('#voltar').click(function(){history.go(-1);returnfalse;});</script><ahref="teste.html?a">link</a>

In any case, try removing the return false if it is interrupting some action on your page.

OBS: Note that there is actually a page in history to go back, as -1 only returns to the previous position, and if it goes to it, in some cases it ignores, put a link to the page in this case (as in breadcrumbs).

Abs

    
29.04.2015 / 21:00