问题
I'm trying to work through the Tableau .js API tutorial, and immediately I got stuck with a ERR_TOO_MANY_REDIRECTS error when I tried to use the online example with a chart I posted to our server.
I am pretty new to this work, so I thought I'd offer the relevant snippet and see if you can spot anything that's likely to generate re-directs in a loop.
Some notes: "" is just a dummy substituion. It is not the problem.
Here is the code. Thanks for any advice!
<!DOCTYPE html>
<html>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type='text/javascript' src="https://online.tableausoftware.com/javascripts/api/tableau_v8.js"></script>
</head>
<body>
<script type="text/javascript">
function initializeViz() {
var placeholderDiv = document.getElementById("tableauViz");
var url = "http://<PATH TO CHART>";
var options = {
width: '1200px',
height: '600px',
};
viz = new tableauSoftware.Viz(placeholderDiv, url, options);
}
</script>
<a href="#" onclick="$('#tableauViz').html(''); initializeViz()">visualize</a>
<div class id ="tableauViz"></div>
</body>
</html>
回答1:
It's nothing to do with the code. I found that it's a credentialing issue. I don't know much about security and log-in resolution, but perhaps this will help someone: I resolved the issue by FIRST logging into Tableau in advance, so that my credentials were already established for that session. Then when I reloaded the above code, it worked. So I infer that I have to work out the credential pass-through issues in advance if this code is going to work well for other users. Anyway, that's the solution path I'm trying next. HTH
来源:https://stackoverflow.com/questions/25896062/err-too-many-redirects-is-my-code-locked-in-a-loop