Auto Refresh Browser When I'm developing

1

2

I'm currently connecting to a server via SFTP so I can edit the files locally and have them uploaded back to the server every time I change / update a file. Well, I'm sick of having to refresh the browser window every time to see these changes.

Are there any apps that will auto refresh for me? I tried LiveReload, but thats only for local files not SFTP.

Nick

Posted 2012-12-13T08:07:55.860

Reputation:

I imagine you might be able to do this with WinSCP using a command. – Jared Farrish – 2012-12-13T08:16:26.723

1

Is pressing F5 really that much effort? You could have refreshed your page 355 times instead of making this post! ;) But seriously, here are some options: http://net.tutsplus.com/tutorials/other/quick-tip-4-ways-to-auto-refresh-your-browser-when-designing-new-sites/ (Also, is there a reason you can't work in localhost while developing?)

– None – 2012-12-13T08:19:57.617

You could also run a script on the server to implement a web socket (in a browser that supports web sockets, like Chrome or Firefox) and setup a socket interface in Chrome for instance to listen for your SFTP client to notify a file was touched and broadcast back to your page(s) to refresh. Seems roundabout, but it makes sense to me.

– Jared Farrish – 2012-12-13T08:37:57.707

Answers

3

In LiveReload there is an option to "Override URLs to serve modified CSS from localhost". It's under the first options box. It will reload the page when making changes to local files but I've noticed that it has some issues with images not showing up on reload.

ferne97

Posted 2012-12-13T08:07:55.860

Reputation:

http://livereload.com/ – Jared Farrish – 2012-12-14T09:05:04.653

1

You could use the old method of using a meta refresh tag:

<meta http-equiv="refresh" content="600">

This tells the browser to refresh the page every 600 seconds.

Make sure you remove it before pushing your site to it's production environment, nobody likes a surprize refresh ;)

Kyle

Posted 2012-12-13T08:07:55.860

Reputation: 338

Ya, I can't do that since its a live site, but thanks. – None – 2012-12-13T08:18:32.660

Aha, well then I don't know of any other resources :) Good luck! – Kyle – 2012-12-13T08:19:51.363

Good answer, but I tried in my browser it's 600 seconds but not 600 miliseconds – None – 2012-12-13T08:22:09.910

Oops, I'll change that, thanks for the heads up :) – Kyle – 2012-12-13T08:22:39.567

I'd probably suggest some background worker script be injected if coming from an IP or some other identifier for yourself, and instead have a script do a compare of the last to current timestamp for your session. Or have the sFTP client ping a script that pushes the new timestamp for the file to an index accessible by the observing script communicating to your browser file changes. Y'know, easy stuff. – Jared Farrish – 2012-12-13T08:47:00.063

0

In addition to Kyle's great answer:

You can use browser plugins to auto refresh pages for you, you can change the interval on the fly unlike the meta tag way of doing things which would require editing the meta tag if the refresh rate is not correct for you.

You can get a list of plugins: http://cerberusweb.com/support/kb/article/62

Ryan McDonough

Posted 2012-12-13T08:07:55.860

Reputation: 73

0

Another solution is to build another page to wrap your web page inside an iframe then in the outer page, use js settimeout to refresh. Thus will not impact other users.

Teddy

Posted 2012-12-13T08:07:55.860

Reputation: 101