简体   繁体   English

从生成的电话中删除 %20: 链接

[英]Remove %20 from generated tel: links

I'm using an saas crm system that allows click 2 dial function.我正在使用允许单击 2 拨号 function 的 saas crm 系统。

Crm generates tel: links as following: https://office.crm.com/_module/crm/view/account_view/tel:+373%20699%2066%20299 crm生成tel:链接如下: 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与软件电话一起使用的唯一链接格式是: 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:"?是否可以使用代码注入器 chrome/firefox 扩展自动从包含“tel:”的所有链接中删除 %20 值?

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/此处演示: 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.这很简单,使用 href 获取所有链接,如果它包含 tel: 字符串,请删除所有 url 编码的空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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