Why does my p5js game not work for iPhones?

I made a little game in p5js and can’t figure out why it won’t work for iPhones. For all I know p5js doesn’t work at all with iPhones though so if that’s the case let me know. The game seems to work fine on PC’s and Android phones.

Unfortunately I can’t do much testing for iPhones either as I only have an old iPhone 4 which can’t run much modern stuff or I can call my Mom and have her try to open the page on her phone, but that hasn’t shown to be particularly helpful…

The game can be played at:

The code is at:

Thanks for any insight to getting it working for ios (if possible).

edit: eliminated a double negative in first paragraph


can you get a console output while running it on your iphone4?

Can you get something simpler working? Display a simple hard-coded shape. Then add a small amount of code until you understand what’s causing the problem. Then try to narrow the problem down to a MCVE so we can help you debug.

So I got everything to display on my iPhone 4 by eliminating two js bugs.

First I had a couple functions which I set a default value for the parameters. Apparently this is a no-no in js but Android and PC let it slide. If you use default params in js they have to be of the ‘null / false’ variety.

Second, I used a few for loops of the following variety:

for (let card of cards) {

These didn’t work and I switched them to:

for (var i = 0; i < cards.length - 1; i++) {

I figure this is an iPhone4 thing cause it’s old and that is a newish for loop.

This got everything to at least display, but not to start the game. I’m using ‘weinre’ to get a console output from the phone (but it’s not outputting what I’d expect it to, like: console.log(“hello world”);, or error messages ).

My function “function mouseClicked() {do stuff}” doesn’t seem to do anything. It’s supposed to start the “loop()”. However something sends the message “start ios!” to my console whenever the screen is touched.

My googlefu has been unable to decode the meaning of this message (“start ios!”). It’s probably incredibly simple. Does anyone know what it means? Btw: this is the only console msg my phone has sent over ‘weinre’, and I don’t know why :frowning:

Through the ‘weinre’ console on my PC I can send the “loop()” command to the phone and the game will start up. “mousePressed()” seems to work to move the character around although the iPhone4 runs it very slowly…

Maybe tomorrow I’ll migrate the “mouseClicked()” commands to “mousePressed()”. I tried a quick solution tonight, but it was unfruitful.

Any feedback is appreciated.

Anyone know what this “start ios!” console output is about? Lastly Chrome doesn’t output that message to my console. Only Safari.

1 Like

This has nothing to do w/ the iPhone version ‘x’ or any other OS at all! :face_with_raised_eyebrow:
We should blame the browser running the app instead! :face_vomiting:

Either install an actual modern browser in your own OS or convert your modern JS code to the jurassic ES5 version of it: :japanese_goblin:

@GoToLoop To be honest, your comment was a rude way to assist someone. you could have offered this advice in a more respectful tone. Please be more Courteous in the future.


Unable to update the ios beyond version 7, so browser updates aren’t available either.

Good to know the problem is with new js on old software though.

All those browsers require iOS 9. My iPhone 4 maxes out at iOS 7. They won’t install…