【发布时间】:2013-12-12 03:52:01
【问题描述】:
我有 joomla 2.5,但我们的第三方移动应用程序大师要求我们在我们的主索引页面中放置一些 javascript。为使用手机的用户将网站重定向到移动应用浏览器。
这里是代码:
<script language="javascript"> <!--
var mobile = (/iphone|ipod|android|blackberry|bb10|windows
phone/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
var userAgent = navigator.userAgent.toLowerCase();
if ((userAgent.search("android") > -1) && !(userAgent.search("mobile") > -1)) {
} else {
// document.location = "http://webapp.to/test"
var r=confirm("Open our Mobile WebApp?"); if (r==true) {
document.location = "http://#"; }
}
}
</script>
问题是:
我需要在哪里粘贴代码?
我已经将它粘贴到:标签之前的主索引模板中,并且还尝试放入 index.php 的第一行。但它不起作用。当我尝试通过我的手机打开时,它没有重定向。
有人可以帮忙吗?
【问题讨论】:
标签: javascript redirect mobile joomla