In my case, Phaser 3 just won't work with Internet Explorer 11. Why?

#1

Hi everybody,

I know Phaser-3 is supposed to run just fine on IE11, and when I try any of the examples on labs.phaser.io, they indead do work.

However, though having no problems at all on any other browser, I find myself unable to get our game running on IE11 (locally), and I really, really wonder why. The error I’m getting is SCRIPT5009: "Int8Array" is not defined at phaser.js(61763,1), followed by numerous errors of the kind SCRIPT5009: "Phaser" is not defined .

I stripped down our code to the barest minimum, which only consists of the index.html and phaser.js and looks like this:

<!DOCTYPE HTML>
<html lang="en">
<head>
   <title>Phaser Game</title>
   <script type="text/javascript" src="phaser.js"></script>
</head>
<body>
<div id="game"></div>
<script type="text/javascript">
   (function () {

       var game = new Phaser.Game({
           type: Phaser.AUTO,
           parent: 'game',
           width: 1024,
           height: 768,
           backgroundColor: 0xffffff
       });
   })();
</script>

</body>
</html>

Still, I’m getting the aforementioned error about Int8Array not being defined, and Phaser not being found (in this instance, right at new Phaser.Game().

I tried on various computers, as well as with various recent versions of Phaser 3 , always receiving the same errors, but only with Internet Explorer 11.

The line where Int8Array is said to not be defined, is this one:

//  Some shared 'private' arrays
var siNext = new Int8Array([ 1, 2, 0 ]);

I’m pretty desperate right now. Does anybody see any error in the above script? Or did anybody ever run into a similar issue? I’d also be really happy with any tips on what I could possibly try…

#2

Hey @Mokrates,
I actually never get this but can you please try to change the self-invoke function to a window.onload like this and give it a try ?

window.onload = function() {
	var game = new Phaser.Game({
		type: Phaser.AUTO,
		parent: 'game',
		width: 1024,
		height: 768,
		backgroundColor: 0xffffff
	});
};

It’s just when i just try to console inside, self-invoke function and window.onload, self-invoke is working faster for me but maybe that’s why it can’t find Phaser yet ?
I’m just guessing here so if it’s work let me know :smiley:

#3

Hi @hcakar ,

and thank you so much for your response and help :smiley: !

Unfortunately, using window.onload like you prescribed didn’t do the trick. Though you probably are not far off the mark as this morning our game actually did run in Internet Explorer 11 on one specific computer. Now, it does not anymore, nor does it on any other PC.
But the fact that it did work for a brief time might suggest that it indeed could be a problem of timing :thinking: .

I’d be really happy about any further suggestions and ideas.

1 Like
#4

Hey Mokrates, it’s probably your Phaser version. Try replacing <script type="text/javascript" src="phaser.js"></script> with <script src="//cdn.jsdelivr.net/npm/phaser@3.16.2/dist/phaser.js"></script>

#5

Thanks for your response, Jake. But a too old Phaser version is not the problem. I already was working with 3.16.2 “Ishikawa”, but tried your snippet anyway. Unfortunately that didn’t solve it.

#6

Odd. I tried your exact code with a local version of Phaser 3.16 and received the following errors in IE11: image

When I updated it to using the CDN, it launched successfully:
image

When running the same code using the CDN on CodePen it also worked:
https://codepen.io/JakeCaron/pen/ZZvvXR

Are you launching a local server to host the html file?

#7

Oh, my greatest apologies!! You are right! I replied too quickly based on an earlier test with a remote URL to Phaser which I took from one of the examples, unsuccessfully.

Now, I tried your snippet (the “CDN”), and indeed, suddenly it works.
Thank you so much!! And again, I apologize for claiming to have tried your snippet, before I actually did.

Yes, I am using a local server. Though I also uploaded the game to our sandbox at some point (yes, I really did, I promise :innocent: ), which resulted in the same errors.

Do you have a suspicion, or anything? Because I’m really puzzled why the remote version of Phaser works, while a local version doesn’t. Or not consistently, sometimes, on some computers, they actually do work. Even a moment ago, I had it running (with local Phaser v3.16.2) on two computers, while a third still insisted on ‘Phaser’ being undefined.
Do you, or anybody else, have got an idea as to why?

#8

No worries, I don’t think it has anything to do with the fact that one is hosted remotely and the other locally. If you copy the code from the cdn link and paste it into your local Phaser file, that should also fix your problem.

Most likely the two differ due to the way they were compiled. (Browserify, Uglify, Minify, etc.)

1 Like
#9

Unfortunately, no. This morning it does not work, again, or not consistently. Not even with the CDN-version. Same errors on two of the three computers. This is driving me crazy…

#10

I got this error when using IE 9 compatibility mode in IE 11

Check if you are on IE 9 mode, change it back to IE 11

My IE 11 works now

1 Like
#11

Whoa, you are amazing!!! That actually does the trick, consistently as it seems! Why the hell does Internet Explorer 11 default to IE 9 compatibility mode?!

Thanks so much!! You people are incredible :blush: !

I will do my research now, but just asking: Does anybody know how to force IE11 to NOT go into older compatibility modes? I’m now going to try <meta http-equiv="X-UA-Compatible" content="IE=edge"> .

1 Like