Javascript函数不调用window.open('tel:12312312');

时间:2017-01-01 11:29:33

标签: javascript html

我想要实现的是在页面加载时自动拨号。

 <body onload="c()">
 <h1><a href="Tel: 8983823057">Call me if not called automatically!!!</a></h1>
  </body>   
  <script>

  function c()
  {
  window.open('tel: 12312312');  
  }

</script>

该代码在某些浏览器(如并行浏览器)上运行良好,但在Chrome上无效。 问题是Chrome上阻止弹出窗口,如何在没有弹出窗口的情况下拨打号码

1 个答案:

答案 0 :(得分:4)

大多数浏览器不允许在页面加载时打开新窗口(调用window.open),因为它在过去被严重滥用。相反,新窗口只能在直接响应用户事件(如点击)中打开。

相关问题