Skip to content

Commit fed8625

Browse files
authored
Merge pull request #64 from lorikku/added-ignore-special-schemes
Added ignore of special schemes such as mailto, sms, tel, etc
2 parents 5fc1da3 + fb7ebf7 commit fed8625

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ const NextTopLoader = ({
167167
const currentUrl = window.location.href;
168168
// const newUrl = (anchor as HTMLAnchorElement).href;
169169
const isExternalLink = (anchor as HTMLAnchorElement).target === '_blank';
170-
const isBlob = newUrl.startsWith('blob:');
170+
const isSpecialScheme = ['tel:', 'mailto:', 'sms:', 'blob:', 'download:'].some((scheme) => newUrl.startsWith(scheme));
171171
const isAnchor = isAnchorOfCurrentUrl(currentUrl, newUrl);
172-
if (newUrl === currentUrl || isAnchor || isExternalLink || isBlob || event.ctrlKey|| event.metaKey) {
172+
if (newUrl === currentUrl || isAnchor || isExternalLink || isSpecialScheme || event.ctrlKey|| event.metaKey) {
173173
NProgress.start();
174174
NProgress.done();
175175
[].forEach.call(npgclass, function (el: Element) {

0 commit comments

Comments
 (0)