不开扩浏览器新窗口/标签+ 48123`链接客户​​端:如何打开`电话 [英] How to open `tel:+48123` link client side without openning new window/tab in browser

查看:165
本文介绍了不开扩浏览器新窗口/标签+ 48123`链接客户​​端:如何打开`电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要,如果我点击电话,提供相同的行为:由本人4842566 链接。默认电话应用应该拨打该号码仅此而已。

I need to deliver the same behaviour if I clicked tel:+4842566 link by myself. The default telephony application should call the number nothing more.

我管理,除了新的选项卡中打开。我写道:

I managed that besides that new tab opens. I wrote:

function Call(){
    window.open("tel:+4842566",'_blank');     
}

和这样的:

function Call(){
    window.open("tel:+4842566");     
}

和这样的:

  function Call(){
        document.getElementById('mymailto').click();
    }


<a href="tel:+48123456" id="mymailto" style="display:none"></a>

结果是相同的。电脑拨打该号码,但新的选项卡公开。

Results are the same. Computer calls the number but new tab is openned.

问:是否有可能调用/不打开新标签/窗口此链接

Question: Is it possible to invoke/open this link without new tab/window?

编辑:之前,我试图运行这个客户端,我做到了在服务器端却没有意识到,当我部署的应用程序是不是谁将会调用客户端:

Before I tried to run this client side I did it on server side but did not realise that when I deploy application it is not the client who will be calling:

public ActionResult Call(int id, string number) {
  System.Diagnostics.Process proc = new System.Diagnostics.Process();
    string formattedNumber = "tel:+48" + formatPhoneNumber(number);
    System.Diagnostics.Debug.WriteLine("NUMBER " + formattedNumber);
    proc.StartInfo.FileName = formattedNumber;
    proc.Start();
    Person person = db.Persons.Find(id);
    return RedirectToAction("Edit", new Person { Id = id });
}

但当时我并没有得到新的标签,也许这将有助于以某种方式。

but then I didn't get new tab, maybe it will help somehow.

编辑2:
我不只是寻找HREF链接事业开展电话:链接仅为2事情发生在同一时间之一:

EDIT 2: I don't simply look for href link cause launching tel: link is only one of 2 things that happen at the same time:

<p>@Html.ActionLink("Call Cell Phone", "Call", new { id = Model.Id, number = Model.CellNumber }, new { @class = "btn btn-default", onclick = "Call();" })</p>

我去控制器动作,并调用呼叫() JavaScript方法和JavaScript的方法是唯一的地方那么简单开扩的任何链接可以做到的。

I go to the controller action and invoke Call() javascript method and JavaScript method is the only place that simple openning any link can be done.

推荐答案

确定。这是小骗,它适用于Chrome,但在IE浏览器,这是我在ASP .NET MVC的Web Apllications的开发利用是行不通的。

Ok. This is little cheat and it works on Chrome, but does not work on IE, which I use in development of ASP .NET MVC Web Apllications.

   function Call(){
        document.getElementById('mymailto').click();
    }

和在HTML中

<a href="tel:+48123456" id="mymailto" style="display:none"></a>

这篇关于不开扩浏览器新窗口/标签+ 48123`链接客户​​端:如何打开`电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆