Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...