Javascript doesn't work on Safari and Firefox

Hi community,

I’m trying to add a go back to the previous page javascript on my website, but it doesn’t work on Safari or Firefox, but it does work on Chrome. Anyone ever had this problem?

I added this piece of code on the header

<script>
function closebutton(){if(history.length===1){window.location="http://www.YOURURL.com/"}else{history.back()}}
</script>

Then I’m using this on Link Settings

`javascript:closebutton();

I found this solution on this post here: Go back link with history.go(-1) - #5 by kvn

Hey,

Not sure why this isn’t working.

Check out the code on Code Crumbs for their back button, it will work for you.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.