Building Websites
When I build websites I use 2 monitors. I have my development IDE on the main monitor and the web page open on the secondary screen.
I get annoyed that everytime I need to refresh the web page I have to go to my mouse, move over to the other screen and click refresh.
I would like to have a shortcut key mapped to reloading the web page whenever I need. In a similar way to how Winamp maps keys to common functions like play/pause etc.
My current research:
Firefox via Command Line
I have discovered that an existing FireFox process can be controled from the command line, however the best it can do is create a new window with a specific URL.
firefox -remote "openURL(www.mozilla.org, new-tab)"
The documentation is here: https://developer.mozilla.org/en/Command_Line_Options
Reload Every
There is also a firefox extension that will refresh the web page periodically. However this results in a constant flickering of the page and will also be wasteful with resources.
https://addons.mozilla.org/en-US/firefox/addon/115/
However, what I really need is either....
- A customisable global hotkey for Firefox/Chrome to reload current selected tab
- A browser extension that could be fired from a Global Hotkey
- A command to reload the current selected tab from the Command Line that I could then map to a hotkey (is it possible to add extra remote command with an extentsion?)
Does anyone know how I could do this? Thanks!
There exists a tool for Windows called Autohotkey that lets you automate almost everything by sending keycodes and mouse clicks. You could write a script that locates your browser window and send the keycode for F5. Assign this script to a global hotkey and you're done.
To get back to your previous window your script would need to remember the currently selected window, refresh the browser and set the focus back to the remembered window.
I use MS Ergonomic Keyboard that has a key-macro feature. I programmed Joshs solution in it and it works well, you just have to make sure, the browser is the next application when switsching with alt-tab. There is a cool tool named XRefresh thats just about every developers dream - doesn't work with firefox 4 though.
Edit: But there is an addon "Auto Reload" that does exactly what we need: you specify one or several folders (or files) and firefox refreshes whenever one of the files inside changes.
Edit (2013): PHPStorm has an automatic refresh feature for Google-Chrome. Its awesome: you see the webpage chnge as you type (!) in the IDE. They have a free community edition for OpenSource software developers.
Thank dogbane and all for share.
Work with Windows 7 you can refresh your browser
Create .bat file and execute
%windir%\SysWOW64\wscript.exe refresh.vbs
and execute .bat with "Run as administrator"
Cannot use CreateObject from VB scripts on Windows 7 x64
:)
There's another solution to this.
Install the FF-Remote-Control plugin in FireFox which will allow you to send commands to the plugin from another machine through network. Instructions on integrating it with VIM are in the documentation which can be used as a template for integration with other editors too. Works only with FF though.
In Windows: Just Press Alt + F5 and get it done. This solution works with more than one browser simultaneously and probably with any Editor/IDE. It was tested with (jEdit, Eclipse, Notepad++)
To accomplish that, install AutoHotKey and run the script below (copy in a text file and change extension to .ahk). There is a portable version here. It was tested with AutoHotKey version is 1.0.48.05
This solution is pretty flexible since you can change Keys, Editors, Browsers and everything else. It come pre configured for Firefox and IE browsers and jEdit, Eclipse editors, but you can easily customize this list.
The varTextEditor and varBrowsers where discovered using "WindowSpy" utility that comes bundled into AutoHotKey.
In Windows XP, this should work:
Create a VBS file called
refresh.vbs
:Create a shortcut to this file on your desktop.
Right-click the shortcut icon and go to
Properties
.In the
General
tab, click on the Change button next to "Opens with". Browse toC:\WINDOWS\system32\cscript.exe
Select Microsoft Console Based Script Host.In the
Shortcut
tab, enter a Shortcut key e.gCTRL + ALT + R
. In the Run dropdown, selectMinimised
.Now, when you hit
CTRL + ALT + R
, it will refresh the current tab in Firefox.