Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    95
    Thanks
    13
    Thanked 1 Time in 1 Post

    keep user's selection through pages

    Hello i have a simple audio player like this
    Code:
    <audio autoplay="autoplay" loop="loop" controls="controls" class="audio">
    <source src="/site/Music/song.mp3" type="audio/mp3"/>
    </audio>
    And i dont want when the user switch pages the song restart or stop

  • #2
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Method 1:
    • A flash website.


    Method 2:
    • Frames (1 frame with player, other with navigable site)


    Method 3:
    • The future


    Method 4:
    • Everything on a Single Page, content loaded by ajax...possible, but not cool for SEO at the mo
    • As far as active browser tab say you were using jQuery you can check that using window.focus & window.blur events:


    Code:
    $(window).focus(function() {
        //dothisandthat;
    });
    
    $(window).blur(function() {
        //dothatandthis;
    });

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    95
    Thanks
    13
    Thanked 1 Time in 1 Post
    I was thinking frames as well but i am not sure if it will looks like what i imagine. Anyway i will work on that tomorrow thanks a lot for your answer!

    also i am not sure what u mean by those
    i will check them as well

    Code:
    $(window).focus(function() {
        //dothisandthat;
    });
    
    $(window).blur(function() {
        //dothatandthis;
    });

  • #4
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Check if the window is active, if so do something i.e play the music!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •