Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In IE you can set the browser width to be 1024x768, for example, to test your site. How can you do this in Chrome? I can't find an equivalent setting anywhere? I'm using 'Tools -> Developer tools'.

I can't do the fallback trick of running

javascript:window.resizeTo(1024,768)

in the location bar, because Chrome tries to search for it!

share|improve this question

1 Answer 1

up vote 8 down vote accepted

You must type (not copy-paste) the entire Javascript (including "javascript:") into the address bar to execute Javascript - Chrome will strip the "javascript:" protocol specification and treat your Javascript as a search if your last action in the address bar is copy-pasting.

A more convenient way to execute arbitrary Javascript in Chrome would be to open the Javascript Console (Ctrl+Shift+J), however, the resizeTo() function is not supported for tabs so you'll need to enter something creative in the console to make this work:

var myTestWindow = window.open(window.location); myTestWindow.resizeTo(1024,768);

(subsequent changes to the pop-up window's size can be made by calling myTestWindow.resizeTo(x,y))

share|improve this answer
    
+1 That JS console way works, thanks. It's a bit inconvenient, but in the absense of anything better it's fine –  Ralph Lavelle Dec 9 '11 at 1:59
    
@Ralph I'd advise against doing this, it incredibly annoying for users to have their browser resized. –  DisgruntledGoat Dec 9 '11 at 10:13
    
@DisgruntledGoat - "...to test your site..." –  danlefree Dec 9 '11 at 17:10
    
Oh, my bad. To be honest it's probably better to resize by hand. I'd wager that no web browser window is ever sized at 1024x768, with task bars and toolbars and such. –  DisgruntledGoat Dec 9 '11 at 22:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.