Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从Sharepoint网站重定向到Android用户无法使用的移动网站_Javascript_Android_Sharepoint_Mobile - Fatal编程技术网

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>