Skip to content

Commit

Permalink
Close tab after the redirect to the external application.
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaimovMR committed May 8, 2019
1 parent 33da0f3 commit afdea12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function log(msg) {
}
log.enabled = false;
var enableNotifications=false;
var internalProtocolsRegexp = /^(chrome-extension|http|https|file|ftp|ws|wss):/;

var storageArea = chrome.storage.local;
//Redirects partitioned by request type, so we have to run through
Expand Down Expand Up @@ -98,6 +99,10 @@ function checkRedirects(details) {
}
ignoreNextRequest[result.redirectTo] = new Date().getTime();

if (result.redirectTo.match(internalProtocolsRegexp) == null) {
window.setTimeout(function(){chrome.tabs.remove(details.tabId);}, 5000);
}

return { redirectUrl: result.redirectTo };
}
}
Expand Down Expand Up @@ -408,4 +413,4 @@ function handleStartup(){
chrome.storage.local.set({
enableNotifications: false
});
}
}

0 comments on commit afdea12

Please sign in to comment.