有人让我创建一个脚本,将移动用户直接重定向到插入电话号码的电话应用程序。而不是查看网页。
不知何故,我的脚本只适用于点击事件,而不适用于页面加载事件。
(function(){
var tel = "tel:+612345678"; // hier telefoonnummer invullen zonder +
function detectmob() {
if(navigator.userAgent.match(/Android/i)){
var dRatio = window.devicePixelRatio;
var width = screen.width * dRatio;
var height = screen.height * dRatio;
if(window.innerWidth > window.innerHeight){
// check landscape max width
if(height / dRatio <= 480){
//document.writeln('ls mobile');
GoToPhone();
}
} else {
if(width / dRatio <= 480){
//document.writeln('p mobile');
GoToPhone();
}
// check potrait width
}
} else if(navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i))
{
GoToPhone();
}
}
function GoToPhone(){
var telLink = document.createElement("a");
var telText = document.createTextNode("call");
telLink.appendChild(telText);
telLink.href=tel;
telLink.id="redirectToPhoneElement";
document.body.append(telLink);
window.location.href=document.getElementById('redirectToPhoneElement').href;
}
detectmob();
})();
问候
您可以在href=“电话:3281769362”
加载的窗口上调用函数,它也可以在手机上使用
function call() {
document.getElementById("call").click();
}
window.onload = call;
<a id="call" href="tel:123-456-7890">Wait</a>
本文向大家介绍nginx配置PC站手机站分离实现重定向,包括了nginx配置PC站手机站分离实现重定向的使用技巧和注意事项,需要的朋友参考一下 使用nginx配置PC站手机站分离,我的PC站和手机站都是nuxt框架写出来的,因为nuxt方便SEO,nuxt是基于vue的提高,不知道的自觉搜索nuxt 1,基于APT源安装nginx 2,在指定目录下新建配置文件test.com:文件名随意 3,编辑
我正在通过react-native-webview在react-native应用程序中播放YouTube embedded LiveStream永久URL。Livestream工作正常。但是当选择一个视频标题或更多视频选项时,webview会显示Youtube网站。我试图阻止这一切。 请建议我防止在webview中显示YouTube网站,或者建议我向其他支持嵌入永久URL播放的库提供支持。提前感谢
说明 支付宝手机网站支付SDK。 官方文档:https://docs.open.alipay.com/60/104790/ 类 SDK类 类名:\Yurun\PaySDK\Alipay\SDK 实例化:$sdk = new \Yurun\PaySDK\Alipay\SDK($params); 公用参数类 类名:\Yurun\PaySDK\Alipay\Params\PublicParams 属性
说明 支付宝境外在线支付-手机网站支付 官方文档:https://global.alipay.com/service/wap_split_cn/6 类 请求参数类 请求参数 类名:\Yurun\PaySDK\AlipayCrossBorder\Online\WapPay\Request 属性 名称 类型 说明 $service string 接口名称 $return_url string 同步返回
说明 支付宝手机网站支付交易SDK。 官方文档:https://docs.open.alipay.com/203/105287/ 类 请求参数类 手机网站支付参数 类名:\Yurun\PaySDK\AlipayApp\Wap\Params\Pay\Request 属性 名称 类型 说明 $method string 接口名称 $return_url string 同步返回地址,HTTP/HTTPS
问题内容: 要在网站上显示某个功能,该功能会在3秒左右的时间内将您重定向到该网站,我该怎么办? 问题答案: