Skip to content

Instantly share code, notes, and snippets.

@beaucollins
Created March 9, 2011 19:30
Show Gist options
  • Save beaucollins/862801 to your computer and use it in GitHub Desktop.
Save beaucollins/862801 to your computer and use it in GitHub Desktop.

Turns any webpage into a mobile web app:

Step 1) Copy this javascript

javascript:d=document;m=document.createElement('meta');m.setAttribute('name','apple-mobile-web-app-capable');m.setAttribute('content','yes');d.getElementsByTagName('head')[0].appendChild(m);

Step 2) Go to the mobile app you want to use (e.g. mail.google.com on your iphone/ipad)

Step 3) Clear the location field in the browser and paste the code you copied and hit "GO"

Step 4) Do the whole "Add To Home" Screen thing

Step 5) Launch the app from the icon it put on your screen

Result: No more Safari chrome and links switch to Safari with new page. App behaves like a native app in that it shows up in your "recent apps tray" when doing fast app switching with the double home button press.

Uses the apple-mobile-web-app-capable meta element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment