最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node.js Application Doesn't Run in Safari or Internet Explorer - Stack Overflow

programmeradmin11浏览0评论

A board game we made using Node.js, Javascript and jQuery works correctly on both Chrome and Firefox, but it doesn't seem to start the Javascript in Internet Explorer or Safari.

Here's a link to the uploaded version: /

I've tried it both from localhost and from the website, and I get the same results. Chrome and Firefox are fine. IE and Safari load the html and css, but large sections are blank (including the game board).

Is there something special we need to do to get it running on those browsers? I'm not even sure what area of the code to look at, and search results have not yielded anything directly related.

A board game we made using Node.js, Javascript and jQuery works correctly on both Chrome and Firefox, but it doesn't seem to start the Javascript in Internet Explorer or Safari.

Here's a link to the uploaded version: http://burningfreak./zb/freelance/wordwars/

I've tried it both from localhost and from the website, and I get the same results. Chrome and Firefox are fine. IE and Safari load the html and css, but large sections are blank (including the game board).

Is there something special we need to do to get it running on those browsers? I'm not even sure what area of the code to look at, and search results have not yielded anything directly related.

Share Improve this question asked Jul 28, 2014 at 3:14 Nightmare GamesNightmare Games 2,4356 gold badges36 silver badges47 bronze badges 1
  • On Safari, I"m seeing the following error: [Error] TypeError: 'undefined' is not a function (evaluating 'Number.parseInt(gameData[1])') app.js line 1042 I don't see the error in Chrome. Perhaps, start there. – ryentzer Commented Jul 28, 2014 at 3:32
Add a ment  | 

1 Answer 1

Reset to default 4

To see the error causing the problem in Safari, you can use the Error Console. This is available in the "Develop" menubar menu that is by default hidden. Enable it through Safari -> Preferences -> Advanced, then check "Show Develop menu in menu bar". A new menu titled "Develop" appears in the menubar at the top of the screen. From there, choose "Show Error Console" and then load your page. You will see this error:

[Error] TypeError: 'undefined' is not a function (evaluating 'Number.parseInt(gameData[1])') (anonymous function) (app.js, line 1042) dispatch (jquery.min.js, line 3) handle (jquery.min.js, line 3) trigger (jquery.min.js, line 3) (anonymous function) (jquery.min.js, line 3) each (jquery.min.js, line 2) each (jquery.min.js, line 2) trigger (jquery.min.js, line 3) (anonymous function) (app.js, line 1018)

This boils down to the Number.parseInt() function, which, according to MDN ..

https://developer.mozilla/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseInt

.. is "experimental technology", and not supported on most browsers. Luckily, there is a "parseInt()" function without the "Number.", which is not experimental at all. Most likely removing the "Number." will at least move you forward nicely:

var playerNum = parseInt(gameData[1]);

Another issue you will notice is that the apps keeps polling on this non-existing URL:

http://burningfreak./socket.io/?EIO=2&transport=polling&t=1406517881111-30

发布评论

评论列表(0)

  1. 暂无评论