An error occurred running the unity content on this page (WebGL Problem)

Hi
I’m Building my NumberWizard_UI game With the WebGL. After complete to make the index.html file, I open the file on Internet Explorer and the flowing massage is up:
“an error occurred running the unity content on this page. see your browser java script console for more info. the error was: access is denied”

I tried it on Unity: 5.5.4 and on Unity: 5.6.1
Any one Know the Answer to the problem?

Often this indicates a “space” in the title of the game, e.g. "Number Wiizard, instead of “NumberWizard”.

Check… remove… rebuild… try again :slight_smile:

If not that, try running it from a different location, e.g. not your desktop. You could try uploading it to ShareMyGame.com :slight_smile:

Hi
Thank’s for your answer
I tried to upload the game to ShareMyGame.com but the Error is still up.
This is the code for the game, It’s Work fine in the local computer, when I Close it to exe file:

NumberWizard_UI code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class NumberWizard : MonoBehaviour {
	// Use this for initialization
	int min;
	int max;
	int guess;
		
	int maxGuessedAllowed = 10;
	
	public Text text;
	
	void Start () {
		StartGame();
	}
	void StartGame(){
	
		min = 1;
		max = 1000;
		NextGuess ();		
			
	}
		
	public void GuessHigher (){
		min = guess;
		NextGuess ();
	}
	public void GuessLower (){
		max = guess;
			NextGuess ();
	}
		
	void NextGuess () {
		guess = Random.Range(min,max+1);
		text.text = guess.ToString();
		maxGuessedAllowed = maxGuessedAllowed - 1;
		if(maxGuessedAllowed <=0){
		Application.LoadLevel("Win");
	}
	}	
}

and this is the code script for the Index.html:

<!DOCTYPE html>
<html lang="en-us">
  <head>
      "Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "Accept, X-Access-Token, X-Application-Name, X-Request-Sent-Time",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
"Access-Control-Allow-Origin": "*",
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unity WebGL Player | game</title>
    <link rel="shortcut icon" href="TemplateData/favicon.ico">
    <link rel="stylesheet" href="TemplateData/style.css">
    <script src="TemplateData/UnityProgress.js"></script>  
    <script src="Build/UnityLoader.js"></script>
    <script>
      var gameInstance = UnityLoader.instantiate("gameContainer", "Build/NumberWizard_web_game.json", {onProgress: UnityProgress});
    </script>
  </head>
  <body>
    <div class="webgl-content">
      <div id="gameContainer" style="width: 800px; height: 600px"></div>
      <div class="footer">
        <div class="webgl-logo"></div>
        <div class="fullscreen" onclick="gameInstance.SetFullscreen(1)"></div>
        <div class="title">game</div>
      </div>
    </div>
  </body>
</html>

If you want to .zip up the entire project and upload it here (10mb limit) I will happily take a quick look and see if there is anything I can spot.


Updated Sat Jun 17 2017 23:31

Incidentally, I applied the code formatting and preformatted text to your post so that I could see the details (links below for reference for future posts)…

Note the following;

<script>
  var gameInstance = UnityLoader.instantiate("gameContainer", "Build/NumberWizard_web_game.json", {onProgress: UnityProgress});
</script>

…particularly “Build/NumberWizard_web_game.json”

Would it be fair to say you didn’t add those underscore, and they were spaces originally when you built the game?

I ask because if you look at the title of the page in the HTML tags;

<title>Unity WebGL Player | game</title>

… I note that it only has the last word…

Hןi Rob
By your Advise I Up Load my game Code for your Check (Thanks in advance)
As you notice about the html code - the code was build by closing the *.sc file to the WebGL Type and I thought that there is something wrong in this file:
.NumberWizard_web_game.zip (4.0 MB)
NumberWizard_web_game.zip (4.0 MB)

The Unity version is 5.6.1
Thank’s
Inbal

Hi Inbal,

Both of these links point to the built game, there’s nothing I can do with that. I need you to zip up the full project and then upload that.

From there I can check the code and also run a build myself to see if I experience the same issues as you.

Hey Rob, I have similar problem for block break

Can you post up the speicifc issues/details please @Hsgngr.

[Solved] Block Breaker Game start to not working this is my problem.

5 posts were split to a new topic: “Uncaught TypeError: Cannot read property ‘id’ of null in”

Privacy & Terms