Web Development :: VSCode, Live Server Plugin, Firefox -- Browser Always Caching, Not Refreshing - visual-studio-code

I'm using VSCode, Live Server plugin for HTML5 web development. When i make a change to my web page then save Live Server should refresh what i see within Firefox. It does refresh but it is always to the oldest cache of the web page when live server first started up. I must always tap CTRL-F5 to force a web page refresh within firefox. The moment i save again within VSCode, the browser display reverts right back to the oldest, first copy.
I've already tried enabling "Disable Cache" within the FF Dev Tools > Networking area. Didnt help. I've tried about.config | browser.cache.disk.enable set to false. Didnt help.
Just wondering if this is normal behavior or if the Live Server plugin (Ritwick Dey) for VSCode is broken.
At the present time

Ok it seemsthe problem was i was using a service worker (sw.js). The browser saw the file, autoloaded it and apparently took full control over caching in the browser -- basically, no matter what i did caching and refreshing was meaningless. I really need to understand this sw.js thing.

Related

Visual Studio Code losing connection to Live Server

I worked on media queries on my website today and all of a sudden my browser won't refresh the site but rather says "No internet. ERR_INTERNET_DISCONNECTED.
I am using Visual Studio Code with Live Server by Ritwick Dey.
Console warning says "DevTools failed to load source map: Could not load content for chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND"
"VM10:6745 crbug/1173575, non-JS module files deprecated."
1 Issue: "Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform"
The site is on my laptop and I'm just working on it offline. What the heck is going on here?
I tried removing the queries.css file to see if that would make a difference. It did not.
Any link on the site will take me to this NO INTERNET page if I am in the responsive dimensions part of DevTools. Also when there is any edit to the html or css in VSC it immediately results in this NO INTERNET page appearing and I have to shut down the port and Go Live again.
I also opened the practice website that we are building for the class and the same thing is happening with that one as well. I have checked my html and css files on validator.w3.org and they have all checked out.
I tried changing the settings in VSC to set the browser to Chrome and also tried in Edge with the same results.
I removed the extension from VSC and reinstalled. No results. Please help!
I had to go into the settings in Devtools and reset.
open Devtools
click the gear icon at right side
scroll to bottom of settings
click "restore defaults and reload"
This made a whole variety of strange problems go away in Devtools and now it works as it should.

Chrome devtools enable cache

I see a lot of questions about how to disable the browser cache in Google Chrome in order to see the changes on the server, but I have the opposite problem. It seems my browser is doing a hard reload every time I press f5. I want to see how the page looks with my javascript edits. How can I do that?
Pressing only F5 does not do a hard reload in Chrome. When you press F5, the local changes that you've made in CSS or JavaScript will be lost. They don't get stored in the cache. However, you should be able to see your JavaScript changes in devtools take effect if that JavaScript part has not yet been called (like document load event).

GWT development with Eclipse

I am developing a GWT app using eclipse and I was wondering if there is a way to hot swap client code changes I make without having to do a full Google Compile each time. Currently when I modify my code, I do a Google compile and then click the Reload server button, then I refresh my browser to pick up the changes. This is starting to get a bit painful as it takes 10 - 20 sec to do a full compile when I may have only modified a UI string so was wondered is there a quicker way.
If you want to see your changes in client code, hit the refresh button in your browser.
If you need debug functions, use Debug As => Web Application. It may be a little (or a lot) slower to start depending on a browser.
If you don't need debug functionality, use Run As => Web Application. It starts faster. You will still see all errors in Development Mode and Console tabs.
If you make changes to server-side code, you have to reload the web server, using the dedicated button of the dedicated Development Mode view in Eclipse.
You never need to recompile unless the plugin tells you to do it.
See https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#DevGuideDevMode
To add to Andrei's answer Assuming we are changing functionality invoked on button click.
1) We usually change lines of code in the function invoked and click the button again in the UI. No need of reloaing the entire application using refresh button.
2) If the change involves code that cannot be hotswapped - example class changes like adding new a class variable, then you need to refresh browser. You can sometimes ignore the eclipse warning complaining that it cannot hot-swap.
3) If you run out of memory then you need to close and relaunch dev mode.
4) If your server side is hogging memory then it might be better idea to use external server rather than jetty to avoid time consumed on server restart for every dev mode launch.

Waiting mouse cursor in my GWT application stays infinitely (only in Chrome, only in Production)

Could you please tell me why I have waiting mouse cursor in my gwt application as if page not fully loaded ? It doesn't happen on dev server. It only happens in production. Also it's happening in Chrome but doesn't in IE.
Link to my app is here.
Screenshot
I checked it again in Chrome, but for me no wait cursor is Displayed. But i think, your Google Chrome is trying to open the Google Translate Menu. For me it came quickly and the page loading stopped and the mouse was at normal position.
I prefer you try updating your chrome.
I have also checked the same in my co-workers Laptop and its working fine too.
If problem still persists, please use CCleaner Software and clear all Temporary files, Browser Cache, Recent files etc. Why because, GWT creates a lot of temporary files which may reduce your system performance. So after each cleaning, just restart the system also. I had few such resolutions recently.
I opened your link in Firefox and got the following error
ERROR: Possible problem with your *.gwt.xml module file. The compile
time user.agent value (safari) does not match the runtime user.agent
value (gecko1_8). Expect more errors
This is because, you have compiled your code for Webkit browsers only. If you have added a line as below in your gwt module xml file,
<define-property name="user.agent" values="ie6">
you may either remove it or you can add more browser support via this.

Java Applet would load only once (in the first window) in Internet Explorer

I am in a bit of fix here. In my company, we have a local intarnet website which has a menu bar in the form of an applet. Few days ago i remember i downloaded an update (either JRE or Windows , i can't recall) and after that in IE strange behavior is observed w.r.t the menu bar applet loading.
If i open the web page first time, the applet would load. when i open a second IE window or tab, the web page would load but the applet just wouldn't load. No Errors, nothing just white space in stead of menu bar applet. If i refresh multiple time, some time the applet would load by itself. purely random behaviour. When i open the website in google chrome, everything works fine. If i open java console, no errors are displayed i.e. the java is just failing to load at all !!!!
I downgraded IE 8 to IE 7 and IE 6 and uninstalled , reinstalled JRE and tried all combinations but the problem still exists !!
Please advice.
yes i did try clearing cach but the problem persists. i mean its purely random. the first time the applet always loads. after that some times it doesn some times it doesn't. No errors at all. Now even google chrome is crashing when ever i open the website saying Data execution prevention error.
Enable the Java console, and enable all logging for it. THis will allow you to see what is actually going on and may allow you to determine why the applet fails.