IE9 framework errors on load

Recommended Posts

Hey Everyone,


I am developing a game that needs to run in IE9 (unfortunately) and the Phaser framework is throwing errors as soon as the JS file is loaded.  Here is a link to illustrate the issue :


All I am loading on the page is an un-minified version of the v2.1.0 framework along with the IE9 dataview-polyfill.js


This is the offending code chunk ( from line 64,217 of phaser.js )

var process=require("__browserify_process"),global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},Buffer=require("__browserify_Buffer"),__filename="/..\\node_modules\\poly-decomp\\src\\index.js",__dirname="/..\\node_modules\\poly-decomp\\src";module.exports = {    Polygon : require("./Polygon"),    Point : require("./Point"),};

It looks like there are extra commas being added on the second last line.


After some deeper investigation it looks like this is happening throughout the code base which is causing the browser (IE9) to throw the error.


Does anyone know a way around this? I started going through and removing the offending commas but there is 80,000 lines of code : /







NOTE : I am using this version of IE9 in a VM on my mac


Share this post

Link to post
Share on other sites

This error is coming from p2 specifically as I don't use browserify anywhere in Phaser, but Stefan does use it for p2.


Do you need to use p2? If not, use a custom build without it (found in the 'custom' folder). If you do then I wonder if there's a way to build p2 from source so it doesn't mess-up IE9. It didn't use to, it used to work fine, so it must be the introduction of browserify into the build process that caused it (at a guess anyway).

Share this post

Link to post
Share on other sites



Do you really think it's browserify, and not just the extra comma?


The troublesome line you found is located in one of the p2 dependencies, poly-decomp (which I also wrote):


I guess I'll have to use JSHint to detect all of these, throughout p2 and poly-decomp. Thanks for the heads up!


Can you try running the minified code instead? Minifying should remove all unnecessary characters anyway.



Share this post

Link to post
Share on other sites

I assumed browserify had added the commas in, but if not then it might just be a result of the original code yes! There is a minified version provided, so I guess the real test is if that works fine in IE9 (+ the polyfill) then we're all good anyway.

Share this post

Link to post
Share on other sites

Hey Guys,


Thanks for the replys.  I did a few more experiments.  These are the variations of the framework I have tried:



Phaser.min.js - Error Object doesn't support property or method 'defineProperty', line 3, character 2900


phaser-no-libs.js - no errors, but I need physics and Pixi  :(


phaser-arcade-physics.js - Error Object doesn't support property or method 'defineProperty', line 603, character 1

This is the offending code:

Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', {    get: function() {        return this._interactive;    },    set: function(value) {        this._interactive = value;        // TODO more to be done here..        // need to sort out a re-crawl!        if(this.stage)this.stage.dirty = true;    }});


I added this user agent compatibility tag into the head of the doc and it now works!

<meta http-equiv="x-ua-compatible" content="IE=edge">


I also retro fitted it to the full framework and that fixed it as well.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.