I'm currently working with this AJAX code snippet:
function ajax(){
if (!navigator.standalone) return;
for (var i= document.links.length; i-->0;) {
document.links[i].onclick= function() {
if(this.getAttribute("class") == "noeffect") return;
var req= new XMLHttpRequest();
req.onreadystatechange= function() {
if (this.readyState!==4) return;
document.body.innerHTML= this.responseText;
ajax();
};
req.open('GET', this.href, true);
req.send();
return false;
};}
}
window.onload= function() {
window.scrollTo(0, 0.9);
ajax();
};
In my setup, I've assigned specific classes to the <body>
on certain pages. Only those classes are excluded when retrieving content.
Is there a method to fetch the ENTIRE body using AJAX? Or perhaps even the complete HTML including the <head>
section.
Your assistance is greatly appreciated :)