Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Hampshire
12,206 PointsHow to test static website on Android device?
Hello,
I'm currently working on creating a static website and I'm to the point where I would like to see what it looks like on smaller screens such as the Galaxy s7. I know that you can use emulators and all, but is there a way that I can hook my phone to the computer and transfer the files and test it on the phone? Or is there a way where I can test it on my phone without loading the website onto a domain and server?
Thanks, Mike
2 Answers
christopher vaughan
1,411 Pointsunfortunately, there's not a "simple" way to accomplish this. Generally when you're developing a site locally, you're gonna have some type of dev environment setup (local server/vm). I couldn't do my job without them! not effectively anyway lol.. I can't think of a way to do it off the top of my head that doesn't involve a server. that being said, here's a few ways we do it in actual development environments:
1) google chrome is your friend! We always test mobile/responsive sites in the google dev tools emulators. they are surprisingly accurate! after all, you're building a website, to run in a mobile browser. Chrome knows how that works :-)
2) upload it to a dev server. This is actually only done during the final stages. I know you said you didn't want to do that but Im including it for completeness.
3) spin up a local vm and use the magic of xip.io (see www.xip.io) to pull it up on your phone, provided you're on the same network. This requires modifying the hosts file of your machine, but it's not hard. you just have to be comfortable doing it.
4) I haven't tried this, but I've always felt like you could probably upload an html file to google drive, and open it on your phone in preview mode. if you try it and it works, please let me know :D
5) the last and most terrible way is to package your site up in an app that consists of a single web view, then shoot the apk to wherever. This is seldom necessary and I've only used it maybe twice in my entire career. But it produces a standalone version of a static website that can be emailed, downloaded, etc... in a very compact and simple format.
hopefully one of those works for you.. seriously, let me know if you try the google drive thing! lol
Michael Hampshire
12,206 PointsThanks Christopher! I'll have to try that google drive method and let you know!
Michael Hampshire
12,206 PointsMichael Hampshire
12,206 PointsBump