Automatic browser refresh during web development

微信扫一扫,分享到朋友圈

Automatic browser refresh during web development

It is well and good that the server restarts automatically for each change in the code. How would you have even the browser refresh automatically, as per configuration (Turn on and off, the least).

How to do it on Windows, and on Linux, for all different development frameworks.

What existing packages allow you to do it, and if you are to just add a browser.refresh at each runserver, how would you do it.

On Mac OS X you can do that using AppleScript. I did that some time ago and been using it ever since.

# Check if Firefox is running, if so refresh
ps -xc|grep -sqi firefox && osascript <<'APPLESCRIPT'
tell app "Firefox" to activate
tell app "System Events"
   keystroke "r" using {command down}
end tell
APPLESCRIPT

# Check if Safari is running, if so refresh
ps -xc|grep -sq Safari && osascript -e 'tell app "Safari"' -e 'activate' 
-e 'do JavaScript    "window.location.reload();" in first document' -e 'end tell'

It refreshes Safari and Firefox, but as I said, it only works the mac. I’ve been using it on Textmate, this way every time I save a django file I also refresh the browsers. Pretty handy, but also slightly annoying when reading docs online and writing code, hehe.

微信扫一扫,分享到朋友圈

Automatic browser refresh during web development

腾讯:架构调整不会涉及裁员 各业务模块整体平移

上一篇

Hooked BUILDING HABIT Forming BUSINESS Products | Book Review

下一篇

你也可能喜欢

Automatic browser refresh during web development

长按储存图像,分享给朋友