avoid adding # to the page URL when clicking dummy links

This commit is contained in:
tophf 2020-07-29 16:50:05 +03:00
parent e1807c8851
commit e0cc9be0e6

View File

@ -85,6 +85,12 @@ onDOMready().then(() => {
// set language for CSS :lang and [FF-only] hyphenation
document.documentElement.setAttribute('lang', chrome.i18n.getUILanguage());
// avoid adding # to the page URL when clicking dummy links
document.addEventListener('click', e => {
if (e.target.closest('a[href="#"]')) {
e.preventDefault();
}
});
function onDOMready() {
if (document.readyState !== 'loading') {