简体   繁体   English

当我将 Tableau 示例中的 URL 更改为另一个 URL 时,为什么我的代码会中断?

[英]Why does my code break when I change the URL in the Tableau sample to another URL?

Why does my code break when I change the URL in the Tableau sample from https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.htm to the below URL?当我将 Tableau 示例中的 URL 从https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.htm更改为以下 URL 时,为什么我的代码会中断? https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/Dashboard1 https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/Dashboard1

ie. IE。 this works:这有效:

  ```
<!DOCTYPE html>
<html>
<head>
 <title>Basic Embed</title>
 <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
 <script type="text/javascript">    
 function initViz(){var containerDiv = document.getElementById("vizContainer"),
 url = "http://public.tableau.com/views/RegionalSampleWorkbook/Storms",
 options = {hideTabs: true, onFirstInteractive: function(){console.log("Run this code when the
 viz has finished loading."); } }; var viz = new tableau.Viz(containerDiv, url, options);}
 </script>
</head>
<body onload="initViz();">
    <div id="vizContainer" style="width:800px; height:700px;"></div>
</body>
</html>
  ```

and this doesn't:而这不会:

  ```
<!DOCTYPE html>
<html>
<head>
  <title>Basic Embed</title>
  <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
  <script type="text/javascript">
  function initViz() {var containerDiv = document.getElementById("vizContainer"),
  url ="https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/Dashboard1",
  options = { hideTabs: true, onFirstInteractive:function(){console.log("Run this code when 
  the viz has finished loading."); } };var viz = new tableau.Viz(containerDiv, url, options);}
  </script>
</head>
<body onload="initViz();">
    <div id="vizContainer" style="width:800px; height:700px;"></div>
</body>
</html>
  ``` 

The format for URLs you need when embedding is different than what you see in your browser's address bar.嵌入时所需的 URL 格式与您在浏览器地址栏中看到的格式不同。 The URL you should use for that viz is https://public.tableau.com/views/OlderWorkers_15998328862500/Dashboard1 .您应该用于该可视化的 URL 是https://public.tableau.com/views/OlderWorkers_15998328862500/Dashboard1 You can get this URL by copying the link from the Share button.您可以通过从共享按钮复制链接来获取此 URL。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试将方法附加到类原型时,为什么代码会中断? - Why does my code break when I try to attach my methods to the class prototype? 为什么jquery代码块中的“ return!1”会导致链接到页面另一部分的定位标记的URL不变? - Why does “return !1” in a jquery code block cause the url not to change for an anchor tag linked to another part of the page? 当我将脚本类型设置为模块时,为什么我的 D3 代码会中断? - Why does my D3 code break when I set the script type to module? CasperJS:为什么我的网址加载时会更改为:空白? - CasperJS : Why does my url change to about:blank when my page is loaded? 当我对src URL进行硬编码时,为什么我的img出现了,但是当我以编程方式分配它时却没有? - Why does my img show up when I hardcode the src URL, but not when I assign it programmatically? 为什么当我删除“.longest”时这段代码会中断? [等候接听] - Why does this code break when I remove the “.longest”? [on hold] 尝试刷新usestate时为什么程序会中断? - Why does my program break when I try to refresh the usestate? 为什么Pinterest代码会更改浏览器中显示的页面(URL)? - Why does the Pinterest code change the page (URL) displayed in the browser? 为什么此循环会破坏我的代码? - Why does this loop break my code? 为什么我的网址在使用角度时包含“!”? - Why does my url contains “!” when using angular?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM