window.location.href 跳转页面, token在chrome 中无效

一.如下,输入token后,点击请输入token登录按钮,
由login.html页提交token后,跳转至 index.html页面.
在谷歌浏览器里不好用,FireFox火狐可用.

也就是说:跳转到index.html后,FireFox带入了token,登录成功;而Chrome,没有带入token,登录失败

如何兼容?

viz 部分是第三方 Tableau 提供的部分,不用管.

二.点击请输入token登录按钮,输出如下错误信息:
image

三.login.html页如下:

<script type="text/javascript">

            function initializeViz() {
              var placeholderDiv = document.getElementById("tableauViz");
              var token = document.getElementById("inputdata");
              var url = "http://124.**.**.**:3306/trusted/"+token.value+"/views/1/1";
              var options = {
                width: placeholderDiv.offsetWidth,
                height: placeholderDiv.offsetHeight,
                hideTabs: true,
                hideToolbar: true,
                onFirstInteractive: function () {
                  workbook = viz.getWorkbook();
                  activeSheet = workbook.getActiveSheet();
                }
              };
              viz = new tableau.Viz(placeholderDiv, url, options);
               
                  window.location.href="index.html";
              
              
            }
    </script>
    
    <body>

    
<input id="inputdata" type="text"  style="width: 30%;"/>

<input id="anniu" type="button" value="请输入token登录" onclick="initializeViz()"/> 

<div class="a" id="tableauViz" style="width:800px; height:800px;"></div>

</body>
阅读 7.5k
2 个回答

重定向的时候把认证信息放在地址栏上就可以了

推荐问题