Javascript 从Sharepoint网站重定向到Android用户无法使用的移动网站
我正在使用一个Javascript 从Sharepoint网站重定向到Android用户无法使用的移动网站,javascript,android,sharepoint,mobile,Javascript,Android,Sharepoint,Mobile,我正在使用一个SharePoint网站,在这个网站上,页面在移动设备中显示得很差,以至于基本上没有功能。我将重建该网站以解决这些问题,但与此同时,我希望将移动用户重定向到一个专用的移动网站,该网站是在SharePoint之外构建的。问题是我的重定向在iphone上运行良好,而在Android操作系统上运行不正常 我在母版页中尝试了以下操作: <script type="text/javascript"> if (screen.width <= 699) { if (docume
SharePoint
网站,在这个网站上,页面在移动设备中显示得很差,以至于基本上没有功能。我将重建该网站以解决这些问题,但与此同时,我希望将移动用户重定向到一个专用的移动网站,该网站是在SharePoint
之外构建的。问题是我的重定向在iphone
上运行良好,而在Android操作系统上运行不正常
我在母版页中尝试了以下操作:
<script type="text/javascript">
if (screen.width <= 699) {
if (document.referrer.indexOf('http://site.html') == -1){
document.location = "http://site.html";
}}
</script>
如果(屏幕宽度
我知道Android用户需要手动启用JavaScript
,所以我想这可能就是问题所在。有没有其他建议
谢谢。当Android上没有可用的javascript时,您需要将重定向逻辑移动到服务器。您有多种选择(为SharePoint构建自己的HTTP模块、用户控件或Web部件)。
一个没有开发技能的解决方案是使用IIS重写模块()。您可以在用户代理上配置它,例如,请参阅
<script type="text/javascript">
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){
if(document.URL !="http://site.html")
{
window.location ="http://site.html";
}
}
</script>
<script type="text/javascript"> // <![CDATA[
if ( (navigator.userAgent.indexOf('Android') != -1) ) {
document.location = "http://SITE.html";
} // ]]>
</script>