Skip to content

Commit

Permalink
Merge pull request #64 from lorikku/added-ignore-special-schemes
Browse files Browse the repository at this point in the history
Added ignore of special schemes such as mailto, sms, tel, etc
  • Loading branch information
TheSGJ authored Feb 2, 2024
2 parents 5fc1da3 + fb7ebf7 commit fed8625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ const NextTopLoader = ({
const currentUrl = window.location.href;
// const newUrl = (anchor as HTMLAnchorElement).href;
const isExternalLink = (anchor as HTMLAnchorElement).target === '_blank';
const isBlob = newUrl.startsWith('blob:');
const isSpecialScheme = ['tel:', 'mailto:', 'sms:', 'blob:', 'download:'].some((scheme) => newUrl.startsWith(scheme));
const isAnchor = isAnchorOfCurrentUrl(currentUrl, newUrl);
if (newUrl === currentUrl || isAnchor || isExternalLink || isBlob || event.ctrlKey|| event.metaKey) {
if (newUrl === currentUrl || isAnchor || isExternalLink || isSpecialScheme || event.ctrlKey|| event.metaKey) {
NProgress.start();
NProgress.done();
[].forEach.call(npgclass, function (el: Element) {
Expand Down

0 comments on commit fed8625

Please sign in to comment.