• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

HTML5 [SOLVED] Projects not working on Internet Explorer

Le Slo

Member
Hey,

I was testing my game on other browsers but it seems that Internet Explorer crashes every time I want to make it work there (both the play button and a index.html build). The issue I get is:

"Web Audio API not supported in this browser" and some reference to "addEventListener".

That made me think the issue was with my audio files or audio function. I started cutting here and there always having the same output: a white screen and a console error.

I created a new project with only the following:

-A font (the default one)

-An object with this line of code in the create event:
Code:
draw_set_font(fnt_default);
And this one in the draw event:
Code:
draw_text_ext(room_width/2, room_height/2, "Sorry, this game does not work in Internet Explorer. Please use another browser.", 125, 600);
Finally a room with a single instance of that object.

The result is the same (even after restarting the computer and clearing both the browser's cache and the GMS2's one).

I have tested with several projects but nothing seems to work in IE, even though some of my projects uploaded on itch.io apparently work (with no sound) on IE.

Why is this happening? Is it normal that the addEventListener is being created in the HTML5 conversion even when there isn't any sound anywhere on the project? Should I do a different clean-up so I can test normally?

Thank you very much in advance!
 

O.Stogden

Member
Internet Explorer is years old and noone really uses it anymore. I wouldn't bother trying to add support for it.

IE also does not properly support HTML5, and has limited functionality for it, Web Audio is one of those limitations, IE will never work with it. Only modern browsers such as Chrome, Opera, Safari, Firefox and Edge do.
 

Le Slo

Member
Thanks for the answer, I ignore this issue for some time but now I want to upload the game to some browser portals, where they directly asked about the issues my games have with Internet Explorer.
Actually my goal is not making the game playable on IE, but only being able to display a message saying that the game doesn't work on that specific browser, but no matter what I try the game won't load because of a null reference to addEventListener. Why is there that event when my projects have no sound?
 

chmod777

Member
Why is there that event when my projects have no sound?
It's part of the runtime, like many other things you might never use (like some in-built variables).

However it's not acceptable that games crash on IE (it's still a supported browser and games work as expected if WebGL is not required). For now, you could do this as a workaround (by using a custom index.html), I think this should work:
Code:
window.onload = function() {
   if(!window.AudioContext && !window.webkitAudioContext) g_WebAudioContext = {};
   GameMaker_Init();
   if(!window.AudioContext && !window.webkitAudioContext) g_WebAudioContext = null;
};
 

Le Slo

Member
Oh! Thank you very much! This was very interesting. I haven't been able to make it work but now I know about how custom index.html work:

-I can make a text file (based on the default index.html) . For finding the default index.html I opened the inspector on firefox's developer tools and copy what was in there to notepad++.
-In the last part (between the <script> and </script>) I should add the code you sent
-I changed the Output Name of the file and the advanced option of "Included file as index.html", both to the included text file I constructed earlier. Now in the inspector I can see the new index file.

Unfortunately I get the same error in the console of IE (I checked there too that the custom index was correctly used): Object doesn't support property or method 'addEventListener', IEsound.js (2186,10).

Have I done something wrong?
 

chmod777

Member
Actually you have to replace this line in the default index.html...
Code:
window.onload = GameMaker_Init;
... to this (I've missed something in my first answer):
Code:
window.onload = function() {
   if(!window.AudioContext && !window.webkitAudioContext) g_WebAudioContext = {"addEventListener": function() {}};
   GameMaker_Init();
   if(!window.AudioContext && !window.webkitAudioContext) g_WebAudioContext = null;
};
 

Le Slo

Member
Yeah, I meant replacing, not just adding because if not the game would initiate twice (I guess, something like writing GameMaker_Init in the console once the game is already running).

And that adjustment you made works perfectly! Thank you very much, you are the best! You not only solved my problem but opened up a new branch of knowledge from GameMaker. I will now adapt my games with some custom index files and finally be free to start some new project!
 
Last edited:

Le Slo

Member
Hi!

I'm here again, after almost one year, because I found that, again, none of my projects work on Internet Explorer. I though that, even when the problem has a different source, it could be nice to have all this information gathered in a single post.

Last time I had a problem with "addEventListener", a part of the runtime that could be avoided with a custom html 5.

Now the problem is caused because the method "isNan" isn't supported, I see in the console the error (I somehow can't upload a screenshot):

SCRIPT 438: Object doesn't support porperty or method 'isNan'
I found this in all my projects, and it is always the same error, so I deduce it's something independent of the project and is because of the conversion to html5.

I'm doing this because I want to show a message when opening the game on Internet Explorer: "This game isn't compatible with Internet Explorer".

Can anyone help me to achieve this?

Thank you very much in advance,
 

chmod777

Member
I think this is just a small piece of JS code to add:
Code:
if(!Number.isNaN && window.isNaN) Number.isNaN = isNaN;
 
D

dmitrydev

Guest
Hey guys,

I keep getting the same issue in IE for projects made in GMS 2.0
Just a blank white screen and nothing happens.

No errors, but strange thing is that I get
ImageLoaded and SoundLoaded messages after Entering main loop.
Seems like it's the main problem.

Anyone knows how to fix this?
 
Top