我正在尝试使用Unity WebGL构建游戏,当我离线运行游戏时没有错误但在上传后我发现以下错误" 访问控制 - 允许 - 来源'标头出现在请求的资源上。"。请参阅此link了解错误详情。
的index.html
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TuneIN Metronome</title>
<link rel="stylesheet" href="TemplateData/style.css">
<link rel="shortcut icon" href="TemplateData/favicon.ico" />
<script src="TemplateData/UnityProgress.js"></script>
</head>
<body class="template">
<p class="header"><span>TuneIN Metronome</span>TuneIN</p>
<div class="template-wrap clear">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" height="1080px" width="1920px"></canvas>
<br>
</div>
<p class="footer">« created with <a href="http://unity3d.com/" title="Go to unity3d.com">Unity</a> »</p>
<script type='text/javascript'>
var Module = {
TOTAL_MEMORY: 268435456,
errorhandler: null, // arguments: err, url, line. This function must return 'true' if the error is handled, otherwise 'false'
compatibilitycheck: null,
dataUrl: "Release/WebGL.data",
codeUrl: "Release/WebGL.js",
memUrl: "Release/WebGL.mem",
};
</script>
<script src="Release/UnityLoader.js"></script>
</body>
</html>