Firefox Developer Command Line
-
0:00 - 0:06Hi, I'd like to take a few minutes to show off this new feature that we have in Firefox 16
-
0:06 - 0:08which should be entering beta about the time you see this.
-
0:08 - 0:11it's called the "Developer Toolbar".
-
0:11 - 0:16You press shift-F2 to bring it up, and there are a lot of interesting things about the "Developer Toolbar".
-
0:16 - 0:17It's a very handy way to get to your tools
-
0:17 - 0:23Plus it'll show you the errors that come up uh... on the page, if there are errors it gives you an error indicator.
-
0:23 - 0:27next to the console there, but what I really want to focus on today is this "Command Line".
-
0:27 - 0:31But this is not a command line for JavaScript, you don't run JavaScript here.
-
0:31 - 0:35This is the command line for running command that control your tools.
-
0:35 - 0:37it's a great way to do things with your keyboard.
-
0:37 - 0:40There are bunch of different commands here for controlling your tools,
-
0:40 - 0:44like "dbg" to control your debugger, "edit" for editing style sheets.
-
0:44 - 0:49Let me show you the "console" command, every command has help which is handy,
-
0:49 - 0:53many commands have subcommands, let you get a various things done.
-
0:53 - 0:55So, in this example:
-
0:55 - 1:00I will open the web console, so now we can see what's inside the console here.
-
1:00 - 1:02Now, there is a keyboard shortcuts for that, of course,
-
1:02 - 1:07it's hard to remember all of those keyboard shortcuts and you really have to twist your finger to do it.
-
1:07 - 1:11But, in this case I have a command line that has completion and everything, so I can do "console clear",
-
1:11 - 1:18and it will clear the console for me when I want to see fresh output, and I can use console close when I'm done.
-
1:18 - 1:25So, that's um... that's a really handy way to kind of fire one feature another.
-
1:25 - 1:30Let's take a look at inspect feature. Now really when you working on the page you often know things about your page.
-
1:30 - 1:35I know there is an element called "#home-news" on this page.
-
1:35 - 1:38and I know that the heading under there is called... is an 'h3'.
-
1:38 - 1:46So, by saying "inspect" and giving that CSS selector, I can actually go directly to that without using my mouse.
-
1:46 - 1:51Now, this is a responsive design, I can see that my font size right now is 28 pixels.
-
1:51 - 1:54What if I want to see how this responds to being on a phone?
-
1:54 - 2:01Well I can bring up the responsive design view, and I'll just say "resize to 320 480",
-
2:01 - 2:04which is about the size that's reported by a lot of mobile phones.
-
2:04 - 2:10Okay, so now you see that I've got a single column kind of view, and our media query has taken effect here.
-
2:10 - 2:14So, now the font size has dropped to 24px thanks to the media query.
-
2:14 - 2:19So, that's pretty cool and it gives me a chance to see, you know, what would this looks like if it was 22 pixels,
-
2:19 - 2:21you know, I can do things like that.
-
2:21 - 2:28And I can... there is actually a command to turn off the responsive design view, or you just press 'escape', which is easier in this particular case.
-
2:29 - 2:34Here's another command that doesn't have a parallel in our existing developer tools.
-
2:34 - 2:38The "cookie list" command, so that lists all the cookies that I have on the page.
-
2:38 - 2:42One of the interesting things here is this command actually gives me multiple options.
-
2:42 - 2:51I can type "cookie remove WT_FPC", or I can just click that right there, and it will populate the command line with that command for me.
-
2:52 - 2:57Here is another feature that's new, if I say "inspect h1"
-
2:57 - 3:00I know there is one heading on this page, one h1 heading
-
3:00 - 3:05What if I want to take a screenshot of just that part of the page and send it to somebody
-
3:05 - 3:09I can use the "screenshot" command, say "heading.png" is the name I want.
-
3:09 - 3:13Now I can just hit ENTER, and what it'll do is to take a picture of what I've got on my window here.
-
3:13 - 3:16But instead, I'm gonna say a "0" delay,
-
3:16 - 3:20I don't wanna do full page, I just want to do this one item which you can see on the screen,
-
3:20 - 3:24and I'm gonna say "h1", because rather than the body I just want to get that h1.
-
3:24 - 3:27So I do that and it has saved into my download directory.
-
3:27 - 3:33So looking there I can see now I have a heading.png just created, and it's the heading that's right there on the page.
-
3:33 - 3:36So it's a super quick way to take the screenshot,
-
3:36 - 3:41and is great you can take screenshots of more than just the visible area without going through hassles.
-
3:42 - 3:47Here's another new command, the "pagemod" command.
-
3:47 - 3:54It lets you do a bunch of different manipulations to the pages, just from the command line here.
-
3:54 - 3:59So I'll show up the simplest possible thing here.
Oops... a typo. -
3:59 - 4:04You can see also my command got an underline everything it helps me when I make mistakes.
-
4:04 - 4:10So, I want to replace that "In the news" text there, what it would... how would it look if I set "News for you" instead, let's find out.
-
4:10 - 4:14Okay, so that's how it looks when I set "News for you". That's a very simple replacement.
-
4:14 - 4:20You can do other cool things like "page mod remove iframe" is fun on many sites, take try that one out.
-
4:21 - 4:24If you want to get into the browser development, this is a cool one to do, "pref set".
-
4:24 - 4:30So the "pref set" command you can set all kinds of hidden preferences that Firefox has.
-
4:30 - 4:36So I'm gonna do "pref set devtools.chrome.enabled", oops I want to set that to "true".
-
4:36 - 4:40What it is going to let me do, is let me manipulate the browser itself.
-
4:40 - 4:42Now this doesn't really take effect until it restarts
-
4:42 - 4:47so I'm gonna to go ahead and "restart", which is another command here, restart the browser now...
-
4:51 - 4:59Okay, so the browser is restarted now. And if I go to "Scratchpad", the Scratchpad tool,
-
4:59 - 5:03We can see the effect of the changes has made. There is an "environment" menu, and I can select the "Browser"
-
5:03 - 5:09and that allows me to run JavaScript code then execute to not just in the context of this browser tab,
-
5:09 - 5:13but actually the context of the whole the browser which means I can write "add-ons"
-
5:13 - 5:16and things like that right here in "Scratchpad". Very cool feature.
-
5:17 - 5:21And one thing speaking about add-ons, uh... one that thing is also very cool
-
5:21 - 5:27about the whole "Command Line" idea, is that it's a very scalable kind of user interface,
-
5:27 - 5:31so you can actually write "add-ons" that add commands. So let me give you an example of one,
-
5:31 - 5:36I'll say "addon enable Firebug", which i had installed but disabled, so it's now enabled.
-
5:36 - 5:40And if I type help, you can see there's now a "firebug" command.
-
5:40 - 5:43And that lets me do things like open firebug,
-
5:44 - 5:48so there is Firebug, I can say "firebug detach",
-
5:48 - 5:50and it's now in the separate window that's pretty handy.
-
5:50 - 5:55If I want to bring it back in, I can just do "firebug attach" again, and "firebug close" when I'm done.
-
5:55 - 6:00So it's great to see that kind of integration you can easily make add-ons to add your own commands,
-
6:00 - 6:04and I hope that we'll soon see a lot of the add-ons.
-
6:04 - 6:05Thanks for watching.
- Title:
- Firefox Developer Command Line
- Description:
-
Firefox makes developing for the Web faster and easier with a unique Developer Command Line. The new tool provides easy keyboard control over Firefox Developer Tools and is intuitive, completing commands and parameters for you.
- Video Language:
- English
- Duration:
- 06:06
![]() |
Maria Dabezies edited English subtitles for Firefox Developer Command Line | |
![]() |
Maria Dabezies edited English subtitles for Firefox Developer Command Line | |
![]() |
Irvin Chen (MozTW) edited English subtitles for Firefox Developer Command Line | |
![]() |
Irvin Chen (MozTW) edited English subtitles for Firefox Developer Command Line | |
![]() |
Irvin Chen (MozTW) edited English subtitles for Firefox Developer Command Line | |
![]() |
Irvin Chen (MozTW) edited English subtitles for Firefox Developer Command Line | |
![]() |
marklee8211 edited English subtitles for Firefox Developer Command Line | |
![]() |
marklee8211 edited English subtitles for Firefox Developer Command Line |