Do Yourself a Favor, Turn On Chrome's Warn Before Quitting

As a developer, keyboard shortcuts are a necessary part of life. And as a web developer, I use several shortcuts within Chrome as well:

  • ⌘ + t: new tab
  • ⌘ + ^ + i: open developer tools
  • ⌘ + shift + {: shift one tab to the left
  • ⌘ + shift + }: shift one tab to the right
  • ⌘ + w: close current tab
  • ⌘ + q: quit Chrome

And if you’ve used the above shortcuts for any period of time, you’ve likely accidentally quit Chrome when you meant to close the current tab. :facepalm:

This used to happen for me at least once a week… until I found Chrome’s Warn Before Quitting option.

Chrome warn before quitting

This obscure gem can be found under the Chrome menu. When enabled, you will need to hold ⌘ + q to quit Chrome.

Copy to Clipboard in Google Chrome Console

When developing for the web, sometimes I want to JSONify an object to throw into Sublime Text for an easier look or maybe to compare two separate objects.

While it’s easy to log an object in Google Chrome, the issue I have is easily getting that from the console to Sublime Text.

After doing a bit of searching, I found that Google Chrome has a copy function that will copy any text to the clipboard.

Here are a couple of ways that you could use this function:

To copy any string, simply use

copy( "some string here" );

To copy a JSONified object, you could use something like:

copy( JSON.stringify( object ) );