Skip to content

Commit

Permalink
Fix redirection when returning from new website (#5527)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Apr 23, 2021
1 parent 2fb218a commit 07e57eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion site_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
$hideAlways = document.getElementById('hide-feedback-request');

var redesignUrl = 'https://simple-icons.github.io/simple-icons-website/',
redesignRootDomain = 'simple-icons.github.io',
hideBannerAlwaysIdentifier = 'hide-banner',
redirectAutomaticallyIdentifier = 'redirect-to-redesign';

Expand Down Expand Up @@ -235,7 +236,7 @@
var redirect = localStorage.getItem(redirectAutomaticallyIdentifier);
if (redirect === 'true') {
$redirectAutomatically.innerHTML = "Disable redirect";
if (document.referrer !== redesignUrl) {
if (document.referrer.split('/')[2] !== redesignRootDomain) {
window.location.replace(redesignUrl);
}
}
Expand Down

0 comments on commit 07e57eb

Please sign in to comment.