Where to attach javascript - go back one page

If I wish to place a back one page icon on a page (say in menu bar) where in blocs do I attach the javascript?

Go Back

Trevor

You can attach the JS in the page settings.

Thanks Norm - but I need an example! I have not a clue as to what the code is that I should place in there and how to link it to the image and which pane to paste it into.

A Knowledgebase on this Forum would be handy.

Go back is such a useful link that it would be useful to have it as a Button Interaction Type option.

@t50ufo You want a back button that is powered by JS? it depends where back is? why not just use the browser back feature? Or do you want to go back to a specific page, in that case you would just use an interaction for URL or Page??

What if a user lands on that page from a link from another site? were does back take them at this point?

The issue that I have come across many times is that an end user doesn’t know what a browser back button is and will remain stuck on a page and quit the site. So some way to offer a real looking button to “go back” is very useful. For sure it has to know where to go but should only be used in potential dead end pages to avoid this situation. Not ideal but a solution nonetheless.

Surely this is were navigation comes in. Why not just include the nav on all pages, then you never have dead end pages. To create a true back button, you would need to get access to the browsers history, I’m not sure that’s aloud and may be unreliable on various browsers if they block it.

The original reason for asking how to place a "Back one page " link was firstly to try to get some personal progress on adding custom html.

I am trying to emulate some core add on features for updating a large static site. On the site in question I have a back one page link on all the pages for 2 reasons. 1. It was much easier to set up the link once and apply it to all pages. 2. Applying various anchor links and links to various pages would have become rather messy. I understand that pages can be made a lot longer and perhaps include the required items all on the one page. A fair point and one to consider.

I believe my customer requested the feature as there was a lot of technical detail or add ons where it was just easier to go back a page.

As I said before Blocs is great! But for us “non coders” is is difficult adding on features when we don’t know where the various parts go. Believe it or not but I have been creating web sites for many years using Freeway. Again I needed a degree of help here and there to add features, scripts etc.

I think what I mean is that those features will come to Blocs in time. There is another bootstrap app that already has a responsive table and various countdowns built in. It took me about a week to figure out how to place a stacking table in Blocs and I am still stuck without an example of a countdown timer. I do prefer Blocs for lots of reasons!

That is why I commented in a previous post it would be great to see a knowledge base on here where we could see some examples of “Things to Try” - as an example I found a collapsing accordion example in the forum somewhere! Great for an FAQ. I can’t find it again! Luckily I downloaded the code to try an example and got it working and was able to add more elements to it. Perhaps if @norm could add Knowledge Base category and appeal to users to share features there it would be a massive boost to us all!

Best wishes to all here on the Forum for a Happy and Peaceful Christmas.

Trev

1 Like

In the RW community this is a feature that was requested often. Big White Duck provide it as a function of their amazing ButtonPlus stack and it is most useful. One use is when using a page as a full screen lightbox or portfolio page that you don’t want to show any navigation yet you do need to give the end user a way back.

I’m not sure why you need a back button. Using a Mac you just use a gesture, two finger swipe to the left takes you back one page on a site. A lot faster than either a back button or the navigation button in the browser.

I think its really overkill for navigation. If the pages are long then a better solution would be to put a second navigation menu at the bottom of the page.

Casey

It’s dangerous to assume all end users are on a Mac and even know that bit of knowledge. I would go so far as to say that more users don’t even know about the browser back button that those who do. The average Windows user couldn’t even tell what a browser is. It’s a big wide world out there and end users need all the help they can get.

My point is that you can try and give all the help you want but when does that cross the line as a waste of the designers time. If someone in todays world does not know where the back button on there browsers window then maybe they not ought to be on the web.

It’s just my opinion, and you know what they say about opinions?

Hey, Merry Christmas @webdeersign

Casey

On a broader point, I recently tested one or two of my sites with older users in their 70s and it made me realise just how hard they can find it to navigate around a site. They can arrive on a site with a large video and watch it, but not then realise they have to scroll down for more information and a cart button to buy a product.

You could argue they are a lost cause, but it’s a real eye opener if you ask a few older people to check out your websites and find their way around. I believe the limits of designing for mobile have actually had a beneficial effect on web design, but this was almost an unintended consequence of designing for smaller screens and not everybody is thinking about this carefully enough.

Depending on your target audience, highly simplified navigation could be a serious consideration, but at the very least it should focus our attention on design from different perspectives and always putting the site visitor first.

@Norm, Sure it’s possible. You can deep link / back button with JQuery, etc., one of the most popular examples is “JQuery Address”, there are many others as well, here are just a few examples. Or see here for the most basic examples of a “go back” button/link with JQuery, vanilla javascript, etc.

Agreed. Sometimes this scares me about Blocs and it’s users, as the statistics are far from it.

Approximately: (as of Fall 2016)
Desktop = 90% Windows --vs-- 7.5 % Mac, etc., others
Mobile = 68% Android --vs-- 25% iOS, etc., others

1 Like

It looks like this never got sorted… or did it elsewhere?

I too would like a back button, with the same function as a browser back button.

Apologies to the haters, but it would help me a lot!

Or you can do something simple like this in a code block

<button onclick="goBack()">Go Back</button>

and the script…

<script>
function goBack() {
  window.history.back();
}
</script>
1 Like

That’s a good simple option. However, people implementing it should take note of the point originally made by @Norm. People could end up clicking the link and end up back at a search page or a referring site.

1 Like

Yes. Very valid point, I wouldn’t use it personally. But it is doable in a simple way.

I did find an interesting solution though. It was a little old, haven’t tried it. But if the domain on the previous page isn’t the same you can redirect to a url or it goes back a page.

if (isset($_SESSION['page_url'])) {
  // visitor has seen another page in this domain
  $previous_page = $_SESSION['page_url'];
}
else {
  // visitor comes from outside, use home page
  $previous_page = 'http://domain.com';
}
// keep the URL of the current page
$_SESSION['current_url'] = $_SERVER['REQUEST_URI'];

I’m just curious :rofl: it’s not something I would use.