[ 15 posts ] Go to page Previous1, 2

Chris Fox

  • Username: ckutopia
  • Joined: Fri Jul 15, 2011 2:12 pm
  • Posts: 9
  • GitHub: Fox
  • Gists: Fox
  • Offline
  • Profile

Re: History Issue With Chrome

Post Posted: Thu Jul 21, 2011 9:23 pm
+0-
I should add to my previous message, maybe it would help if I explained what I was trying to do.

1. On page load I want to add a back history to the browser.
2. Only when the user hits back, I want to fire some javascript.

My code works perfectly in IE and Firefox, but not in Chrome.

Thanks, Again.

Ryan Grove

YUI Developer

  • Username: rgrove
  • Joined: Tue Dec 09, 2008 9:55 pm
  • Posts: 275
  • Location: Portland, OR
  • Twitter: yaypie
  • GitHub: rgrove
  • Gists: rgrove
  • IRC: rgrove
  • YUI Developer
  • Offline
  • Profile

Re: History Issue With Chrome

Post Posted: Fri Jul 22, 2011 8:47 am
+0-
The code you've provided so far never calls history.add(), so it's never actually adding a new history entry. If this really is the code you're using (I assumed it was just sample code to explain your problem), then maybe that's the issue?

Unless a new history entry is added, the back button will always return the user to the previous page rather than the previous history state.

Chris Fox

  • Username: ckutopia
  • Joined: Fri Jul 15, 2011 2:12 pm
  • Posts: 9
  • GitHub: Fox
  • Gists: Fox
  • Offline
  • Profile

Re: History Issue With Chrome

Post Posted: Fri Jul 22, 2011 1:52 pm
+0-
I used initialState: {kittens: null,} to add a back element. It works fine in IE and Firefox. I'm I doing something wrong?

Ryan Grove

YUI Developer

  • Username: rgrove
  • Joined: Tue Dec 09, 2008 9:55 pm
  • Posts: 275
  • Location: Portland, OR
  • Twitter: yaypie
  • GitHub: rgrove
  • Gists: rgrove
  • IRC: rgrove
  • YUI Developer
  • Offline
  • Profile

Re: History Issue With Chrome

Post Posted: Fri Jul 22, 2011 2:28 pm
+0-
initialState specifies the default state that should be used when a state hasn't been set yet, but it doesn't actually create a history entry. A history entry won't be created until you call add().

Chris Fox

  • Username: ckutopia
  • Joined: Fri Jul 15, 2011 2:12 pm
  • Posts: 9
  • GitHub: Fox
  • Gists: Fox
  • Offline
  • Profile

Re: History Issue With Chrome

Post Posted: Sat Jul 23, 2011 10:50 am
+0-
Thanks Ryan, I used history.add() and some other things you said and now it works exactly like I want. Thanks for all your help.
  [ 15 posts ] Go to page Previous1, 2
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum