簡體   English   中英

從生成的電話中刪除 %20: 鏈接

[英]Remove %20 from generated tel: links

我正在使用允許單擊 2 撥號 function 的 saas crm 系統。

crm生成tel:鏈接如下: https://office.crm.com/_module/crm/view/account_view/tel:+373%20699%2066%20299

與軟件電話一起使用的唯一鏈接格式是: https://office.crm.com/_module/crm/view/account_view/tel:+37369966299

以下問題。 是否可以使用代碼注入器 chrome/firefox 擴展自動從包含“tel:”的所有鏈接中刪除 %20 值?

謝謝你。

這樣的事情應該為你做:

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

此處演示: https://jsfiddle.net/k0pjv65m/1/

這很簡單,使用 href 獲取所有鏈接,如果它包含 tel: 字符串,請刪除所有 url 編碼的空格。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM