Javascript not only works on older iOS

Asked

Viewed 322 times

-4

Hello, this site: https://www.enmoda.com.br/fale-conosco/, is working normally in all browsers that I have been able to test, including in a newer iOS iPhone emulator, but in older iOS (on an iPhone 4 for example), all Javascript does not work.. so, if I try to send the form from this link, instead of javascript doing the validation of the form fields, the form is sent.

I believe it must be a javascript error only on older systems, but I can’t debug on iOS.

In Safari Mac, it seems that gives this Warning:

the source list for content security policy directive 'default-src' contains an invalid source: "strict-dynamic". it will be ignored.

But it doesn’t stop the site from loading normally in Mac Safari.

Can someone help me? Thank you.

  • 1

    I recommend removing the link to the site and elaborate a [mcve] demonstrating the problem in place not to run the risk of being punished for spam.

  • The problem is I don’t know where the problem is.. on the Chrome console no error appears, on new iPhones, everything is normal... only on iPhones and old iPads that does not work... in fact, maybe my doubt is not even to help me with the code, I need help on how to debug to find the error on these devices.. I even have an iPhone 4, but I don’t have a Mac.... there is some way?

  • So wouldn’t it be interesting to ask, really, this? And to generate [mcve] all you have to do is simplify your code. Do something like alert('Ok') and see if it works on iPhone 4. If it doesn’t work, you’ll already have your example. If it works, increment the example with what you did in the application until it stops working.

  • ;-) I’ll do it. Thank you

1 answer

0


Debugging with the "Alerts" that @Anderson Carlos Woss suggested, it took a while, but I was able to find the problem... it was the Arrow Functions of javascript, it seems that this does not work in any old browser:

setTimeout(() => {
     alert('teste');
}, 1000);

I had to trade for this:

setTimeout(function(){
    alert('teste');
}, 1000);

at this link: https://caniuse.com/#feat=Arrow-functions You have more compatibility information for Arrows Functions... anyway, 2019 is not ready for them, I will stop using them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.