简体   繁体   English

电话号码和重定向的超链接

[英]Hyperlink for telephone number and redirect

We are building an application where the initial access would be from a mobile phone. 我们正在构建一个应用程序,该应用程序的初始访问将来自手机。 As such upon entry to the page. 这样进入页面。 we want to give the user the opportunity to dial in if necessary, and as that occurs open another page in the browser in the same window. 我们希望在必要时为用户提供拨号的机会,然后在同一窗口中的浏览器中打开另一个页面。

I have tried this: 我已经试过了:

<a href="thispage.htm" target="_self" onclick="window.open('tel://1-555-555-5555'">Dial</a>

as well as this: 以及这个:

<a href="tel://1-555-555-5555" onclick="window.open('thispage.htm','_self';">Dial</a>

Neither approach has worked. 两种方法均无效。 In the first instance, the hyperlink works but the telephone dialer doesn't recognize the onClick event, and the opposite occurs when the second approach is attempted, ie the telephone dialer shows the number but the page doesn't open in the browser. 在第一种情况下,超链接有效,但电话拨号器无法识别onClick事件,而在尝试第二种方法时,情况则相反,即电话拨号器显示该号码,但在浏览器中未打开页面。

Any suggestions would be appreciated! 任何建议,将不胜感激! Mike 麦克风

Try 尝试

<a href="tel:2125551212">2125551212</a>

as mentioned here . 这里提到的。

Perhaps I wasn't clear... In the above code, the hyperlink portion of the code works fine. 也许我不清楚...在上面的代码中,代码的超链接部分工作正常。

What isn't working is the window.open code! window.open代码不起作用! My guess is that the solution will be more like my second piece of code posted above, as when the "tel://555-555-5555" is used as the hyperlink it appears as expected in the dialer on a mobile phone, but if I return to the browser from the dialer the browser is not pointing to the page referenced in the window.open event. 我的猜测是,该解决方案将更像上面发布的第二段代码,就像将“ tel:// 555-555-5555”用作超链接一样,该超链接会在手机的拨号器中正常显示,但是如果我从拨号程序返回浏览器,则浏览器未指向window.open事件中引用的页面。

Mike 麦克风

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

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