Skip to content

Instantly share code, notes, and snippets.

@brehaut
Created June 20, 2011 04:41
Show Gist options
  • Save brehaut/1035133 to your computer and use it in GitHub Desktop.
Save brehaut/1035133 to your computer and use it in GitHub Desktop.
Bookmarklet that opens the current page in an iphone sized window
/*
javascript:%28function%20%28%29%20%7B%0A%20%20var%20w%20%3D%20window.open%28window.location%2C%20window.title%2C%20false%29%3B%0A%20%20w.resizeTo%28320%2C480%29%3B%0A%20%20w.onload%20%3D%20function%20%28%29%20%7B%0A%20%20%20%20var%20b%20%3D%20w.document.body%3B%0A%20%20%20%20b.style.overflow%20%3D%20%22scroll%22%3B%0A%20%20%20%20w.resizeBy%28320%20-%20b.offsetWidth%2C%200%29%3B%0A%20%20%7D%3B%0A%7D%29%28%29%3B
*/
(function () {
var w = window.open(window.location, window.title, false);
w.resizeTo(320,480);
w.onload = function () {
var b = w.document.body;
b.style.overflow = "scroll";
w.resizeBy(320 - b.offsetWidth, 0);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment