Javascript 当我将Tableau示例中的URL更改为另一个URL时,为什么代码会中断?
为什么在更改Tableau示例中的URL时代码会中断 到下面的URL? 也就是说,这是有效的:Javascript 当我将Tableau示例中的URL更改为另一个URL时,为什么代码会中断?,javascript,html,url,tableau-api,Javascript,Html,Url,Tableau Api,为什么在更改Tableau示例中的URL时代码会中断 到下面的URL? 也就是说,这是有效的: ``` <!DOCTYPE html> <html> <head> <title>Basic Embed</title> <script type="text/javascript" src="https://public.tableau.com/javascripts/api/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 = "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>
```
```
基本嵌入
函数initViz(){var containerDiv=document.getElementById(“vizContainer”),
url=”http://public.tableau.com/views/RegionalSampleWorkbook/Storms",
options={hideTabs:true,onFirstInteractive:function(){console.log(“当
viz已完成加载。“);};var viz=new tableau.viz(containerDiv,url,options);}
```
但这并不是:
```
<!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>
```
```
基本嵌入
函数initViz(){var containerDiv=document.getElementById(“vizContainer”),
url=”https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/仪表板1“,
options={hideTabs:true,onFirstInteractive:function(){console.log(“在
viz已完成加载。“);};var viz=new tableau.viz(containerDiv,url,options);}
```
嵌入时所需的URL格式与浏览器地址栏中的格式不同。您应该为该viz使用的URL是https://public.tableau.com/views/OlderWorkers_15998328862500/Dashboard1
。您可以通过从“共享”按钮复制链接来获取此URL
你把这个html块放在哪里?C:在我的笔记本电脑上。第一个html块在任何浏览器中都可以轻松打开。代码中唯一的更改是URL从启用到新URL上的所有权限