Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread history.pushstate and the Back Button
Fri, Feb 14 2014 11:28 AMPermanent Link

Matthew Jones

Anyone know anything about history.pushstate and the Back button? And how EWB might
use it? A friend said "I see you break the back button", and what he really meant
was my app doesn't - click Back after 5 mins in the app and you go back to the page
before. In his, he navigates around, and the Back button takes him back within the
app.

Strikes me that either the back button should be disabled after a minute to stop
big fails, or I should try to handle it better.

Thoughts?

/Matthew Jones/
Tue, Feb 18 2014 11:26 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Anyone know anything about history.pushstate and the Back button? And how
EWB might use it? A friend said "I see you break the back button", and what
he really meant was my app doesn't - click Back after 5 mins in the app and
you go back to the page before. In his, he navigates around, and the Back
button takes him back within the app.  >>

Your friend has never used a proper web application. Smile The back button
doesn't work for *any* single-page web application, including Google Mail,
etc.  It's how they're designed.  There is simply no separate URL to push
onto the history, even if we wanted to.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Feb 18 2014 12:05 PMPermanent Link

Matthew Jones

Well, I don't know much about it, but the application he's done is at:

http://benchmarker.nyruralschools.org/

You click on an item, and drill down, and you can use Back to, err, go back. I note
the URL changes, but it looks sensible.

I think that it might be nice to be able to disable the Back button in an EWB app,
perhaps after the user has been on the page for a while to stop mistakes.

/Matthew Jones/
Tue, Feb 18 2014 4:57 PMPermanent Link

Walter Matte

Tactical Business Corporation


That back button - is a button in the application - not the Browser "Back" button.

So it is just like any button we drop on an EWB form.

The question is how does he alter the Address in the browser....

Walter
Tue, Feb 18 2014 5:57 PMPermanent Link

Robert Devine

I must admit I haven't tried it, but I'd hoped to use something like
this https://github.com/browserstate/History.js. This is an interesting
article -
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

Cheers, Bob


On 14/02/2014 16:28, (Matthew Jones) wrote:
> Anyone know anything about history.pushstate and the Back button? And how EWB might
> use it? A friend said "I see you break the back button", and what he really meant
> was my app doesn't - click Back after 5 mins in the app and you go back to the page
> before. In his, he navigates around, and the Back button takes him back within the
> app.
>
> Strikes me that either the back button should be disabled after a minute to stop
> big fails, or I should try to handle it better.
>
> Thoughts?
>
> /Matthew Jones/
>
Wed, Feb 19 2014 4:26 AMPermanent Link

Matthew Jones

Try the "real" back button too - it works the same as the "soft" one.

/Matthew Jones/
Wed, Feb 19 2014 4:26 AMPermanent Link

Matthew Jones

It would be good if we could push some state or other, and then use the onPopState
event to catch it, and either take action, or ask the user if they really want to
leave the application.

/Matthew Jones/
Wed, Feb 19 2014 9:56 AMPermanent Link

Robert Devine

They appear to be using what's known as hashrouting - AFAIK the history
stuff replaces that. But I'm no expert on this.

Cheers, Bob


On 18/02/2014 17:05, (Matthew Jones) wrote:
> Well, I don't know much about it, but the application he's done is at:
>
> http://benchmarker.nyruralschools.org/
>
> You click on an item, and drill down, and you can use Back to, err, go back. I note
> the URL changes, but it looks sensible.
>
> I think that it might be nice to be able to disable the Back button in an EWB app,
> perhaps after the user has been on the page for a while to stop mistakes.
>
> /Matthew Jones/
>
Thu, Feb 20 2014 10:47 AMPermanent Link

Mark Brooks

Slikware

Avatar

>>They appear to be using what's known as hashrouting - AFAIK the history
>>stuff replaces that. But I'm no expert on this.

Yup. That's it. To display a "new view" in your app, simply modify the browser URL **AFTER** the #. This will fire an event that you can trap, without reloading the app, allowing you to show the new view. However, this will also be stored in the browser history so that the back (and forward) buttons work as expected (i.e. traversing through visited views).
Mon, Feb 24 2014 4:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Well, I don't know much about it, but the application he's done is at: >>

His application is not really a single-page web application - he could have
just as easily used separate URLs for each page.  Trying to force the
back/forward design on a single-page web application is a mistake, IMO.
It's possible to do, of course, but very confusing to the end user because
now you've introduced an element of "maybe" into the design.  IOW, you
either make every single navigation/action in your application use the
history state so that it works with the back/forward buttons, or you don't.
If you do it only sometimes, then your user won't know what to make of
things.

Tim Young
Elevate Software
www.elevatesoft.com
Image