Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Avoid displaying history back if referrer is from different domain
<div id="breadcrumbs_back" style="display: none">
<button class="button" onclick="history.go(-1); return false"><span><span><?php echo $this->__('Back') ?></span></span></button>
<script type="text/javascript">
var breadcrumbs_back = $('breadcrumbs_back');
if(breadcrumbs_back) {
var referrer_host = document.referrer.split('/')[2];
var host = '<?php echo $_SERVER['HTTP_HOST'] ?>';
if(referrer_host && referrer_host == host) {
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment