Jump to content

Files not loading in browser - even on refresh


dbawel
 Share

Recommended Posts

Hi,

 

I've wasted considerable time due to my assumptions and past experience in working with browsers.  One of the biggest issues was due to accelerated development; trying to advance to quickly in using the BabylonJS framework.  Within a few days, I moved to character driven .babylon files and building my own objects and animating using pushkeys.  Thus, I didn't provide enough time to move through a logical development process, which is often a problem when doing what I call "crash developing."  So the problems I encountered were entirely my own doing.  :huh:

 

I doubt this will affect most problems with loading files correctly, however here is what I discovered from viewing so many white browser screens, and especially those WONDERFUL 404 error messages.  The following is a response I wrote on another post:

 

 

What I discovered this last weekend was that the problem is a combination of two issues.  

First, our server appears to have timing issues, and I assume it's due to traffic but we're looking into this further.  Second, and most affecting our problems is that the browser uses it's cache much longer than I thought. I assumed that if I launch a new Chrome browser, that Javascript files were refreshed.  However, there is no refreshing of any files that I can find until the refresh button is pressed.  I couldn't properly troubleshoot this as the timing problems wouldn't expose a changed file even on refresh for up to 10+ seconds.  So, even though the files were correct upon refresh, the browser loaded from cache as the server didn't respond in a timely fashion.

 

The only way I discovered this was to start from a sample scene online.  I used the loadScene.html file from paddyschller.com, and copied ALL of the files from the working directory into a new directory on our server.  When I found this basic scene loaded correctly (mostly), I then renamed the babylon.js file so that it could not be loaded.  I then refreshed the page and of course the scene wouldn't load at all.  Then I renamed the babylon.js file correctly on the server, and the scene still would not load with a new Chrome browser and typing the full path to the html file.  I refreshed the browser and found the file still wouldn't load - so I retried (refresh button) until it loaded.  I have the exact same results when using links with no browser open, and realized that the only way to refresh any files was to press the refresh button.

 

I assume there is a setting in the advanced options in Chrome to change this, but I haven't looked yet.  For developing quickly, I hope an automatic refresh can be set.  

 

 

Again, I don't know if this is affecting anyone else, however I'm guessing were all modifying Javascript files as quickly as possible and copying those to the server for immediate testing.  So I thought it worth posting - although slightly embarrassing for me.  :rolleyes:

In the posts I read on this forum, many people are receiving a 404 error in their browser, so I assume a potion of these might be due to browser cache refresh.  At the minimum, it forced us to encrypt our login info and rewrite our webconfig file.

 

If this helps anyone, please let me know.

 

Cheers,

 

DBawel

Link to comment
Share on other sites

Hi DBawel,

 

there are many ways to avoid this "js not refreshing" problem. I find the best to be simply developing locally until you are happy about the result :-) Most lcaol dev servers will support no-caching.

But if this is not an option, the best two ways would be:

  1. Setting the expired header to a date in the past. This can be done with the web framework (or server) you are using. (The headers "Cache-Control", "Last-Modified" and "Expires" are important here)
  2. Using the browser's devtools to prevent caching. Every browser have this option. In Chrome it is under general in the devtools settings (F12, Settings, Disable Cache while devtools is open). In IE it is under the Network tab ("Always refresh from server").
Link to comment
Share on other sites

Hi raananw,

 

I will definitely change the settings in all browsers.  But if i have any issues, i never thought about changing the headers -although headers can change depending on environment - but great to target files and for toubleshooting.  I think this is good advice for all who are developing.

 

cheers,

 

dbawel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...