简体   繁体   中英

Remove %20 from generated tel: links

I'm using an saas crm system that allows click 2 dial function.

Crm generates tel: links as following: https://office.crm.com/_module/crm/view/account_view/tel:+373%20699%2066%20299

The only link format which is working with the softphone is: https://office.crm.com/_module/crm/view/account_view/tel:+37369966299

Following question. Is it possible with a code injector chrome/firefox extension to automatically remove the %20 value from all links that contain "tel:"?

Thank you.

Something like this should do it for you:

document
    .querySelectorAll('a[href]')
    .forEach(
        (link) => {
            if(link.href.includes('tel:')) {
                link.href = link.href.replace(/%20/g, '');
            }
        }
    )
;

Demo here: https://jsfiddle.net/k0pjv65m/1/

It is pretty straightforward, grab all links with an href, if it includes the tel: string, remove any url-encoded spaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM