Submitting forms using iFrames on iOS devices

Silent but deadly

Working on AtYourService.com.cy I have to submit a lot of forms using iframes since almost all forms have file attachments and a lot of feedback from our application before completing the process. A weird bug was eating my brain when all forms that returned html messages in the response object suddenly stopped working on iOS devices. I used a jQuery extension which submitted the form in an iframe and I returned json encoded data from the server. The script simply wrapped the response in a <pre> tag and fetched the contents to decode and pass them back on the client side handler. All works fine unless you have some numbers in an html json property and mr Apple decides to convert them to anchor links with a tel: prefix in the href to call phones directly. A handy little feature when it works correctly. But since the double slashes are not escaped you are left with an invalid json syntax. The quick solution is to just return the data and construct the html with javascript. it is indeed more efficient but when you are developing an mvp or just testing an experiment you simply dont’t have or want to waste time on making two templates.