Back-End/Node.js
Node.js | 웹, 웹앱에서 핸드폰 기능 (ex 전화걸기, 문자보내기)
개발자티포
2022. 4. 25. 11:22
728x90
반응형
location.href 메소드를 이용해서 아주 간단하게 전화걸기 기능을 구현할 수 있다.
1. 전화걸기
function phoneCall(phoneNumber) {
location.href = "tel:" + num;
}
phoneCall("01011112222");
2. 영상전화걸기
function phoneCall(phoneNumber) {
location.href = "tel-av:" + num;
}
phoneCall("01011112222");
3. 문자 보내기
function phoneCall(phoneNumber) {
location.href = "sms:" + num;
}
phoneCall("01011112222");
4. 메일 보내기
function phoneCall(phoneNumber) {
location.href = "mailto:" + num;
}
phoneCall("01011112222");
이것들은 a 태그 또는 버튼태그로도 사용할 수 있다.
<button onclick="document.location.href='tel:010-1234-5678'">
<a href="tel:010-1234-5678">010-1234-5678로 전화걸기</a> </div>
728x90
반응형