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?

Edited by Manixat
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.