If I'm going to call pushState, but I want to keep all the relative links, images, style sheets, etc., I am doing something like this so far:
$('[href]').each(function() {
if (!/^#/.test(this.href)) this.href = this.href;
});
$('[src]').each(function() { this.src = this.src });
My question is: will this work with cross browser? Do I need to do $(this).attr('href') = this.href?
It's necessary? Is there any other way to do this? Is this the best way to do this? And will he always work?
source
share