Skip to content

Commit

Permalink
Don’t redirect if AMP is also the canonical
Browse files Browse the repository at this point in the history
Resolves issue #4.
  • Loading branch information
da2x authored Dec 5, 2017
1 parent ebb96a9 commit cd1e6f9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions amp2html.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if (document.querySelector("html[amp],html[⚡]")) {
!(amp != null && amp.href == canon.href)) {
canon = canon.href.trim();
if (null != canon &&
document.location != canon &&
(canon.startsWith('https:') || canon.startsWith('http:'))) {
document.location.replace(canon);
} } }

0 comments on commit cd1e6f9

Please sign in to comment.