So I had a thought on the bus the other day: Wouldn’t it be cool if I could test my responsive websites in multiple screen-sizes, without having to rubber-band my browser width back-and-forth, and back-and–forth, and back-and–forth? If I could see all the breakpoints that were important to this project at the same time, side-by-side, in a single window? Thus an idea started to form…
The implementation is simple: Take a URL and pass it to a bunch of inserted
<iframe>s, each set to the width of a different breakpoint. Then, with one click, refresh all those
<iframe>s (like, after I’ve made some change to something). And that’s basically what I have here:
The process probably doesn’t need instructions, but here they are anyway:
- Enter the URL you want to test into the “Enter the URL to test:” box
- Enter a comma-separated list of breakpoints (the widths you want to test) into the “Enter your comma-separated breakpoints:” box
- Click the “Display Viewports” button (or just hit the “Enter” key)
- You should then see a series of
<iframe>s (one for each breakpoint you designated) start loading into the page (see the “Known Issues” below)
- Once all the
<iframe>s have loaded (each should be vertically scrollable, as if it were a small-screen device), the parent container should be horizontally scrollable, if you’ve requested more breakpoints than can fit into your browser window
- There will be two new buttons at the top of the page: 1) “Refresh Viewports”, which let’s you refresh all of the
<iframe>s with one click, and 2) “Clear Viewports”, which clears all of the
<iframe>s and resets the page as it was when you first arrived
Note that each URL and set of breakpoints you view are appended to the URL, so it becomes something you can pass around for easy viewing. When the page loads, it checks for them and, if present, populates the text boxes but does not automatically create the
<iframe>s, in case the receiver wishes to edit something.
Additionally, I’ve created a little Bookmarklet that, when clicked, grabs the URL of the page you’re viewing and opens a new tab/window with that URL inserted into the text box, ready to load the
This gets really fun when you start testing sites that are really taking advantage of @media queries to alter their sites based on screen size. Here are a few examples:
- Some sites serve themselves with a
header tagthat prevents the site being loaded into a cross-domain
<iframe>(sites like Google and Yahoo!); without this
header, sites should load just fine
Amazingly, the morning after sending this link to a couple friends for their thoughts, I find this link during my morning commute RSS-fest… Ah well, just goes to show great ideas are always out there…
Nicely done. This would have come in reallly handy, oh, about three weeks ago! Nice, minimal UI too. Such a basic premis turns into a useful tool. Sometimes the simplest ideas are all we need to focus on! (Now can I do simultaneous, parallel JS debugging?) ;-)
@Jerome: Yeah, it can start turning into a little M. C. Escher if you test the RTE site, then each of those test the RTE site, and so on… :-) At some point, Chrome realizes I’m f-ing with it and stops loading the
<iframe>s, but it’s fun until then… :-)
Hi to every body, it’s my first pay a quick visit
of this weblog; this weblog includes amazing and
actually good data designed for readers.
This page really has all the information I needed concerning this subject and didn’t
know who to ask.
Awesome! Exactly what I was looking for. Thanks a bunch!