Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

javascript - Is there a way using Jquery to detect the back button being pressed cross browsers

I have a website that is on a slide show and when the user presses the back button I would like it to go back to the album view not the prior and prevent page. Is there a way of doing this? thanks for any help or advice.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

jQuery Address provides strong cross-browser support for browser history and Ajax crawling:

http://www.asual.com/jquery/address

http://github.com/asual/jquery-address

Greetings

UPDATE:

you can find a good sample right here:

http://jsfiddle.net/5L6Ur/10/

some code in short:

 $(function() {
    $('a').click(function(e) {
        e.preventDefault();
        $.address.value($(this).attr('href'));
    });
    var changecount = 0;
    $.address.change(function(e) {
        if (typeof e !== 'function') {
            $('span').html(changecount++);
        }
    });
 });?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...