Operating System:
Iphone OS
Problem:
Because of some google analytics problems when a user browse a page with an iphone i was required to show a popup telling the user's that there is a app for the website and when you close it to show the old page.
Soution:
<<hide the page>>
$('meta[name="viewport"]').attr('content', 'width = device-width, maximum-scale=1.0;');
/*width = device-width show the smaller popup as fullpage. maximum-scale=1 dosen't allow the popup to be zoomed in. */
<<Show popup>>
on close popup
<<show the page>>
$('meta[name="viewport"]').attr('content','width='+$(window).width() + ', height=' + $(window).height() + ', initial-scale=0.5;');
/*Set the content width to windows width and height as well. With the initial-scale you can play arrow. That is the value i found works best in my particular case*/
Resources:
https://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html - official apple doc. You can see the description for every value of the viewport there.
What have i learned:
Programming Javascript for Iphone OS and Android is very hard. They are very picky. I very big problem that i have was that after i close the popup the viewport use to leave a dark impression on the page even if it scrolled out. I have no idea how i managed to get ride of that but i finally did. Keep trying to swich around the values until they work.
skip to main |
skip to sidebar
Pages
Thursday, 17 May 2012
Labels
- add_column (2)
- alias (1)
- Android (2)
- api (2)
- arguments (1)
- autocomplete (1)
- bang (1)
- border (1)
- browser (1)
- check (1)
- css (1)
- csv (1)
- darnket (1)
- data (2)
- database (1)
- db:migrate (1)
- debugger (1)
- default (1)
- default user (1)
- development (2)
- down (1)
- effects (1)
- Emacs (4)
- Emacs24 (1)
- eventmachine (2)
- expectations (1)
- factory girl (2)
- file (1)
- first (1)
- focus (1)
- function (1)
- gem (1)
- git (2)
- highlights (1)
- html (1)
- ie7 (1)
- index (1)
- internet (1)
- Iphone (1)
- javascript (3)
- jquery (3)
- jquery-ui (1)
- JQUERY. toggleClass (1)
- key biding (1)
- mac (2)
- mac osx (3)
- method (1)
- migrations (2)
- mock (2)
- mocks (2)
- mongodb (1)
- MySQL (3)
- namespace (1)
- operators (1)
- optimizing (1)
- password (1)
- popup (1)
- postgresql (2)
- RAIL_ENV (1)
- rails (16)
- regex (1)
- regular expressions (1)
- remove_column (1)
- repair (1)
- repository (1)
- resize (1)
- rspec (7)
- rspecs (6)
- ruby (16)
- ruby on rails (12)
- sdk (1)
- select (2)
- server (1)
- shortcut (1)
- specs (3)
- stash (1)
- stub (4)
- stub_chain (1)
- terminal (2)
- test (1)
- traits (1)
- trusted source (1)
- tutorial (1)
- Ubuntu (6)
- validation (1)
- value (1)
- viewport (1)
- windows (1)
- windows7 (1)
Powered by Blogger.
0 comments:
Post a Comment