JavaScript not working in Safari on iPad

2019-06-25 22:49发布

问题:

We have a large web application and we have found that it is not working properly in Safari on an iPad. Although we have an iPad for testing, it doesn't seem to be possible to see JavaScript errors in Safari on it. The Web Inspector feature seems to need a Mac, which we don't have.

Go to https://desktoplawyer.secureclient.co.uk/dtl/index.cfm?event=base:tryDocument&rapidocsid=5700, click Next, click "England and Wales", click Next: every other browser now takes you to a page entitled "Preliminary questions", but in Safari on the iPad it stays on the page entitled "Domicile".

What are my options? And please don't just tell me that we have to buy a Mac ;-)

回答1:

Something similar happened to me not too long ago. Try adding the following header on the server side responses to POST requests and see if it works:

Cache-Control: no-cache

The thing is, starting from iOS 6, Safari Mobile caches AJAX POST methods with an identical function signature. This means that the method will only be performed once and the server's response will be saved and reused for several additional requests. If you are making the same POST requests on your site several times you may have a problem getting new information.



回答2:

You could try using the Ripple Emulator to emulate the iPad in your browser https://github.com/blackberry/Ripple-UI

Another option would be some remote debugging tool like weiner - http://people.apache.org/~pmuellr/weinre/docs/latest/

Maybe try downloading Safari for windows and testing it there?

FYI: Following your steps in Safari on my mac worked w/o error.