I'm trying to implement the following: the site has a certain menu, working on the onclick="followLink(event, this)" function. Everything, in principle, works fine, but on one of the pages - I just don't have javascript loaded, which should work with a certain player (it also uses javascript. That is, when I go to the page I see the necessary javascript in the links in the source code, but the player fulfills it, as if it does not exist at all.
The method of smooth page change:
function followLink(event, link) { var nameLink = link.innerHTML; uploadContent(link.href+'&ajax=1'); history.pushState({title:nameLink, href:link.href}, null, link.href); updateTitle(nameLink); event.preventDefault(); } function updateTitle(title) { var link = document.createElement('link'); document.getElementsByTagName('head')[0].appendChild(link); link.setAttribute('type','text/css'); link.setAttribute('rel','stylesheet'); link.setAttribute('href','/templates/styles/player.css'); link.setAttribute('type','text/javascript'); link.setAttribute('rel','javascript'); link.setAttribute('href','/templates/js/jquery.jplayer.js'); var elm = document.getElementsByTagName('title')[0]; elm.DOM = title; } function uploadContent(link) { var cont = document.getElementById('content'); cont.innerHTML = loading.innerHTML; function createRequestObject() { processData:false if (typeof XMLHttpRequest === 'undefined') { XMLHttpRequest = function() { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} throw new Error("This browser does not support XMLHttpRequest."); }; } return new XMLHttpRequest(); } var http = createRequestObject(); if( http ) { http.open('get', link); http.onreadystatechange = function () { if(http.readyState == 4) { $("#content").css("display", "none"); $("#content").fadeOut(1000); $("#content").fadeIn(2000); cont.innerHTML = http.responseText; } } http.send(null); } else { document.location = link; } } window.addEventListener("popstate", function(e) { uploadContent(e.state.href); updateTitle(e.state.title); }, false );