Jump to content

History Pushstate


Manixat

Recommended Posts

Hello freaks,

 

I've set up an ajax system and I'm in need to use the pushState method. Unfortunately I'm not quite aware of how that works. I went through a bunch of tutorials and examples and still couldn't figure it out. What I have is this

	$('.tabs > li').click(function(e){
		e.preventDefault();	
		
		var target = $(this).children('a'),
		    title = target.attr('alt'), // This is equivalent to .html(), I have a translating engine so the html is variable according to the language
		    obj = {url:target.attr('href')};
		history.pushState(obj, title, target.attr('href'));
	});

 

And this works as long as I don't press the back button, when I do the URL goes back to what it previously was but the page remains the same, why is that?

Link to comment
https://forums.phpfreaks.com/topic/276587-history-pushstate/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.