Jump to content

How do I add a 'back' button?

Recommended Posts

  • Replies 12
  • Created
  • Last Reply

Here's a good post on CSS-Tricks about adding a back button to a page.

http://css-tricks.com/snippets/javascript/go-back-button/

As Chris points out, browsers have back buttons so this isn't necessary usually. But if you need to get it done, this code sample from the post will do the trick.


<input type="button" value="Go Back From Whence You Came!" onclick="history.back(-1)" />    

Developer Evangelist at Squarespace.

Link to comment
  • 4 weeks later...

I am also in need of a back button for each of my "pages" of my work. Please see this page as a referencehttp://www.yaochengdesign.com/art-prints/waves

I tried the code but I didn't know where to place it (header? footer?) since I need it in multiple places. Also, if I want to use my own image for the back button, where I do write that in the code?

Thanks!

Link to comment
  • 2 years later...

The code posted by foleyatwork is good. Here's some more information thought ...

If you're using an

<a>

tag remember that the

href

attribute will cause Safari and Firefox (and maybe Explorer, but who cares really) to load an empty page, or refresh the page which creates problems. In order to avoid that, remove the

href

attribute altogether, and instead use an inline style for the cursor for when you hover over it.

Here is the code similar to what foleyatwork posted above but without the button styling


<a onclick="window.history.go(-1);" style="cursor:pointer;" >GO BACK</a>

Link to comment
  • 1 year later...
  • 2 months later...

I am looking for that too. More specifically, a BACK (to last page in the series) and NEXT (to next page in the series) like there is in the blog. I want to make it easy for the user to just click next, next, next without returning to the 'gallery' page. ideas?

Link to comment
  • 8 months later...
  • 1 year later...

Archived

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

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.