Good day. I use the SoundManager2 player for the site, but when I navigate through the pages, all the music is cut down. Tell me, how can I make the player work without reloading the page?

UPD

I made the player work through AJAX in this way: when clicking on a link, using the script, only the content part is loaded so the player works and is not interrupted. But it works only when switching to the first section of links, that is, from site.ru to site.ru/razdel, if I want to switch from site.ru/razdel to site.ru/razdel/razdel only then everything happens with a simple transition. Will you help?))

$(document).ready(function() { $('a.menuside').click(function(m) { m.preventDefault(); var action = $(this).data('action'); var murl = $(this).data('murl'); var mid = $(this).data('mid'); var mtpl = $(this).data('mtpl'); $.post(document.location.href, {action:action,mid:mid,mtpl:mtpl}, function(data) { $('#wrapcontent').fadeOut(300, function() { history.pushState(null, null, murl); $(this).html(data).fadeIn(800); }); }); }) }); 
  • That is, to work in VKontakte? - Jean-Claude
  • It turns out yes, or how it is here

1 answer 1

Option 2:

  1. The site should be SPA .
  2. Save the state of the player (in localstorage , for example) and retrieve it on every boot. But this is fraught with interruption of playback and small inconsistencies (save for leaving the page - window.onbeforeunload ).
  • Found such a solution. Stackoverflow.com/questions/16774/ ... At first glance - what you need, but I don’t understand how to fasten ((( - Batyabest
  • This is the first option. Substitute the address (just using the HTML5 History API ), download the relevant content and show. - user207618
  • And how to stir it up do not tell? - Batyabest
  • @Batyabest, this is a big and not very simple question. Search the net for how to create them. - user207618
  • Do I understand correctly - you need to pass in the URL of the page, get the content and display it in the right block, in where the content is displayed. And then using the function to replace the address in the browser line? - Batyabest