Advertisement

That game you made in HTML 5?

Started by June 11, 2015 12:16 PM
8 comments, last by fastcall22 9 years, 7 months ago

It's no longer working in Firefox.

https://bugzilla.mozilla.org/show_bug.cgi?id=1173716

This happens with FireFox, Chrome and IE ... so it leads me to believe that everything is executed in order once the page is loaded.


<html>
<script>
window.onload = a();
document.write("This is not a function. <br>");

function a(){
     document.write("This is a function. <br>");
}
</script>
</html>

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Advertisement

No, it does not happen with Chrome. Indeed, it didn't happen in Firefox 37... I know because up to 38.01 my game maker was working on it.

I'll bet it broke on 38.01.

...Which really shouldn't have happened. They should have had something to test such basic, essential functionality.

38.0.6 is the current FF version.

I still am getting the exact same behavior in all three browsers.

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Because, genius, you used window.onload, not image.onload.

The issue you seem to be having is the .onload functionality.

Using your code, I received the same results in all thee browsers as before.


<html>
<script>
ima = new Image();
ima.onload = a();
ima.src = "/exp.png";
document.write("This is not a function. <br>");

function a(){
     document.write("This is a function. <br>");
}
</script>
</html>

.

.

.onload firing before images are loaded seems to be a common issue some folks have according to Google [LINK]

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Advertisement

Please keep in mind that "this doesn't work the way I expect it to" and "this doesn't work they way it uesd to" are not necessarily bugs.

The real issue here seems to be that you have written code that assumes certain behavior which is not actually guaranteed.

The real issue here seems to be that you have written code that assumes certain behavior which is not actually guaranteed.


This is the #1 problem of web development in one concise statement. This needs to be engraved somewhere on at every web developer's workspace.


This needs to be engraved somewhere on at every web developer's workspace skull, with a pickaxe.
FTFY.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Don't be silly, wrap your willy in a setTimeout(willy,0);

This topic is closed to new replies.

Advertisement