简体   繁体   中英

Click to Call in phonegap app

I have a very simple phonegap app which consists of 2 html pages. One page is a directory listing and I want to be able to click to call or click to sms on the entries. The click to call/sms works when I serve the page from a website, but not when I include the same page in the phonegap www fold and build a simple app.

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width initial-scale=1.0" />
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <script src="js/jquery-1.11.1.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <title>Mobile Group Directory</title>
</head>
<body style="background-color:#A5C1C9">
  <div class ="container-fluid">
    <div class="panel-group" id="directory">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">
            <a data-toggle="collapse" data-parent="#directory" href="#A">    Anteater, Alfred</a>  cell:<a href="tel:1234567890">123-456-7890</a> <a href="sms:1234567890">Send SMS</a>
          </h3>
        </div>
        <div id="A1" class="panel-collapse collapse">
          <div class="panel-body">
            Alfred<br>123 Smart Way<br>Braintown, MO<br>anteater@yahoo.com
          </div>
        </div>
      </div>
      <br>
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">
            <a data-toggle="collapse" data-parent="#directory" href="#B2">  Brown, Bob</a>  cell:<a href="tel:9876543210">9876543210</a> <a href="sms:9876543210">Send SMS</a>
          </h3>
        </div>
        <div id="B2" class="panel-collapse collapse">
          <div class="panel-body">
            Bob<br>345 Middle Way<br>Low Risk, MO<br>bob@msn.com
          </div>
        </div>
      </div>

    </div>
  </div>
</body>

试试这个代替:

document.location.href = 'tel:a number'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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