I am trying to load different pages with refresh using jquery with the help of window.history.pushState('','',url);
function goto(event,el)
{
url=el.href;
event.preventDefault();
window.history.pushState('','',url);
//$('html').load(url);
$.get(url, function(data) {
var head=data.match(/<head[^>]*>[\s\S]*<\/head>/gi);
$('head').html(head[0]);
//$('#content').html($(data).find('#content').html());
var body=data.match(/<body[^>]*>[\s\S]*<\/body>/gi)
$('body').html(body[0]);
});
}
HTML is loading before CSS and there will be around 1-2 second of naked html display then css is loading completely
All my pages are different so i have to load different css, script everytime.
Is there any way to load the css quicker than the html or is there ant better way to load whole page or replace the current page content with new page.
I really don't want to use any plugin