Here is the part of the page2Image project source code, you can download study and research.      The page2Images is to capture the desktop web site on a mobile phone a full-size display thumbnails. There are a lot of mobile emulators in the internet.But most of them are fake and does not support javasript  and flash very well.Also, they does not support redirect actions. You will not see the real result in the phone.  Page2Images provide this tool to fix all of those problem.