Reputation: 759
I need to parse query param from my google site and display it in an iframe. I'm using Google Script for that:
function doGet(e) {
var template = HtmlService.createTemplateFromFile('Index');
var test = e.parameter.test;
template.test = test;
console.log(test);
// Build and return HTML in IFRAME sandbox mode.
return template.evaluate().setTitle("KPIs")
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
var test = document.getElementById('test').innerHTML;
if (test=="undefined") {
var test = "DEFAULT";
}
</script>
</head>
<body>
<div id="test"><?=test?></div>
</body>
</html>
Refused to display 'https://....' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".
Upvotes: 0
Views: 474