dqyhj2014 2017-02-28 12:36
浏览 131
已采纳

网址方案sip:on chrome扩展程序不起作用

On a chrome extension app (in browser works perfect, in the app doesn't) i added

<a href="sip:phonenr"> phonenr </a> 

but every time i click on it i get this message:

This site can’t be reached

The webpage at sip:phonenr might be temporarily down or it may have moved permanently to a new web address.

ERR_UNKNOWN_URL_SCHEME

"tel:phonenr" --- also doesn't work

"mailto:test@test.com" --- don't know how, but it works

Any solutions ?

  • 写回答

1条回答 默认 最新

  • dongliechuich10319 2017-03-10 16:00
    关注

    L-am facut saraciieeeee! (Ignore this :) )

    You can catch the error with the loadabort listener, filter out your url specific to your needs, I needed to create a new url from the tel/sip request, and I sent some extra params after the phone number. If the url is created correcty I open a new tab in the browser (chrome.browser.openTab), the url shows a simple page with a link with href="tel:xxxxx", that works find with 3rd party apps. At the end we go back 1 history so the chrome packaged app doesn't display the error message.

    That is the compromise solution I have found.

    webview.addEventListener('loadabort', function(e) {
            if (e.url.match(/^tel:/)) {
                var url = e.url.replace('tel:', '').replace('link=', '');
                url = url.split('?');
                if(url) {
                    chrome.browser.openTab({url: url[1] + '?phone=' + url[0] });
                }
                webview.go(-1);
            }
        });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)