desafelinksifier



the following is a javascript bookmarklet for the web version of outlook. not much else to say

  1. bookmark anything, for example this page.
  2. right click the bookmark > click edit.
  3. change the title to whatever and the URL to the following:

javascript:(()=>{document.querySelectorAll(‘a[originalsrc]’).forEach(l=>{let u=l.getAttribute(‘originalsrc’);l.href=u;l.title=u;if(/safelinks.protection/i.test(l.textContent)){l.textContent=u}})})()

  1. when you have an email open, click the bookmark, and it will change all safelinks in view to their original URLs.

the original code indented properly:

javascript:(() => {
  document.querySelectorAll('a[originalsrc]').forEach(l => {
    let u = l.getAttribute('originalsrc');
    l.href = u;
    l.title = u;
    if (/safelinks.protection/i.test(l.textContent)) {
      l.textContent = u;
    }
  });
})()

thanks maria for suggesting an improvement