views:

98

answers:

1

Does anyone know how to view the HTML code of a webapp that's saved to the iPhone home screen? Some webapps redirect to a different html file when they get "promoted" to the home screen. It's that code I'd like to examine.

A: 

According to Apple's documentation, the mode in which a webapp is being viewed can be retrieved using JavaScript. So, if you send the iPhone's User-agent header from your computer and then grab a copy of the first HTML document that gets served up (before JavaScript has a chance to do any redirects) you should be able to find some JavaScript code that decides how to display the webapp based on the iPhone viewing mode.

David
Except that webapps check navigator.standalone to see if the app is on the home screen.
AtlasBody
@AtlasBody: Yes, that's why I'm suggesting you look at the JavaScript code that the webapp uses to do check `navigator.standalone`. You should be able to see, by reading the code, what it would do if it found itself running on the home screen. Presumably it would either manipulate the DOM to alter the contents of the page, or just redirect you to a different URL.
David