Last active
February 29, 2024 14:17
-
-
Save mikeoberdick/db99f7da4414b48b61271e19bf13ce6d to your computer and use it in GitHub Desktop.
Create a button to go back to the previous page with referrer checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $referrer = $_SERVER['HTTP_REFERER']; ?> | |
<?php if (str_contains($referrer, 'simplify-the-market-blog')) { | |
$href = "javascript:history.back()"; | |
else { | |
$href = "/simplify-the-market-blog"; | |
} ?> | |
<a href="<?php echo $href; ?>" class="btn"><i class="la la-angle-left"></i> Back</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment