我想从amp iframe中的cdn加载javascript,但它给出了错误。
”未捕获的DOMException:无法从中读取'cookie'属性 '文档':该文档已沙盒化,缺少 'allow-same-origin'标志。”
当我粘贴html文件和iframe代码时,普通javascript在amp iframe中工作正常。在此先感谢您,如果有人可以帮助我解决该错误
html文件名:-testfile.html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<p>Click the button to display an alert box.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>
</body>
</html>
<amp-iframe width="300" height="200" sandbox="allow-scripts allow-popups allow-modals" layout="responsive" frameborder="0" src="https://test.com/testfile.html">
答案 0 :(得分:0)
SELECT
REGEXP_SUBSTR(REGEXP_SUBSTR('1-2-3','([0-9] *- *[0-9] *- *[0-9])',1, 1, 'i'),'([0-9] *- *[0-9] *- *[0-9])',1,1,'i') AS Tmp,
REGEXP_SUBSTR(tmp,'(^[0-9])',1,1,'i') ||'-' || REGEXP_SUBSTR(tmp,'([0-9]$)',1,1,'i') AS final_exp;