【发布时间】:2020-06-27 20:03:53
【问题描述】:
我有以下 HTML/ASPX 页面。
直到今天它工作得很好。
现在我收到一个跨站点错误,尽管对阻止第三方 Cookie 或添加站点以允许进行了任何更改,但我无法像今天一样显示我的页面。
我使用的是 chrome 版本 80.0.3987.132,在我清除所有浏览/缓存/cookie 历史记录之前,此版本一切正常。
JS 脚本将 Iframe 插入到具有特定 ID 的 DIV 中。 我无法将此行为更改为 API (Spotfire) 有没有办法解决此类示例中的跨站点资源问题?
在没有SameSite 属性的情况下设置了与https://server.com/ 的跨站点资源关联的cookie。它已被阻止,因为 Chrome 现在仅在使用 SameSite=None 和 Secure 设置时才提供带有跨站点请求的 cookie。您可以在开发人员工具中的 Application>Storage>Cookies 下查看 cookie,并在 https://www.chromestatus.com/feature/5088147346030592 和 https://www.chromestatus.com/feature/5633521622188032 上查看更多详细信息。
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta charset="utf-8">
<title>Spotfire Template</title>
<!--Spotfire Javascript API-->
<script type="text/javascript" src="https://server.com/spotfire/js-api/loader.js"></script>
<style>
/*Style the Divs that will hold the Spotfire Pages */
#Element1 {
padding: 0;
margin: 0 auto;
width: 100%;
height: 1090px;
}
#Element2 {
padding: 0;
margin: 0 auto;
width: 100%;
height: 1090px;
}
</style>
</head>
<body>
<!--Include Div Elements with IDs to hold the spotfire pages-->
<div id="Element1"></div>
<div id="Element2"></div>
<script>
//Specify Parameters
var app;
var doc;
var webPlayerServerRootUrl = "https://server.com/spotfire/wp/";
var analysisPath = "/Folder/Analysis";
var parameters = '';
var reloadInstances = false;
var apiVersion = "7.14";
var customizationInfo = {
showAbout: false,
showAnalysisInformationTool: false,
showAuthor: false,
showClose: false,
showCustomizableHeader: false,
showDodPanel: false,
showExportFile: false,
showExportVisualization: false,
showFilterPanel: false,
showHelp: false,
showLogout: false,
showPageNavigation: false,
showReloadAnalysis: false,
showStatusBar: false,
showToolBar: false,
showUndoRedo: false
};
//Declare more variables to add additonal Spotfire Pages
var view0;
var view1;
spotfire.webPlayer.createApplication(webPlayerServerRootUrl, customizationInfo, analysisPath, parameters, reloadInstances, apiVersion, onReadyCallback, onCreateLoginElement);
function onReadyCallback(response, newApp) {
app = newApp;
if (response.status === "OK") {
// The application is ready, meaning that the api is loaded and that the analysis path is validated for the current session (anonymous or logged in user)
console.log("OK received. Opening document to page 0 in element renderAnalysis")
//Add Items here for more pages , You can use Integers for Page Index or Title of Pages {First Element is the DIV ID and second is the PageName/PageIndex}
view0 = app.openDocument("Element1", 0);
view1 = app.openDocument("Element2", 1);
} else {
console.log("Status not OK. " + response.status + ": " + response.message)
}
}
function onError(error) {
console.log("Error: " + error);
}
function onCreateLoginElement() {
console.log("Creating the login element");
// Optionally create and return a div to host the login button
return null;
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript google-chrome cookies