Forcing(version 10) Firefox Reload - javascript

I googled
Firefox Force Reload and read / scanned the first 4 hits.
All say to use either Control R or Control F5. Neither of these work for me. The only way I I have been able to force a reload (of my javascript) is by re-starting.
I pull in 3 files CSS, HTM, and JS all by Ajax Post. Oddly, the CSS and HTM reload but the .js is cached.
It's looks like the browser is checking file extensions of ajax posts and auto caching .js despite the reload method.
Is there a way to force a reload of .js. I just double checked the above solutions and they do not work.
Furthermore, What is the mechanism that let's Firefox know when to cache and when to download?

What I normally do is disable the caches built into firefox. Then all you have to do is refresh the page no special key strokes required. To do this in your url bar enter about:config then find the settings browser.cache.disk.enable and browser.cache.memory.enable set them both to false and restart. Problem solved forever.

To force reload, press Control + Shift + R. This will empty the cache and reload all page elements.

Open the javascript file in its own tab and control+F5 on that page. Then reload the page that uses the javascript file. That worked for me when all other methods failed.

Related

Image is not being displayed on test server/

I have a weird problem where an image is displayed in other platforms but the image is not being displayed on the test server. I have thoroughly checked the code and there is no problems with the code. Any ideas or anyone had this issue before?
Image is displayed like this but only on the test server. The rest are working fine.
I’ve had issues like this where there were missing mime type mappings on one server vs another.
So the server was not serving the files correctly.
Possibly check your mime type mappings, not sure what server version or otherwise you’re using to help further though.
Considering your comment mentions that your files are being correctly loaded in other browsers, this isolates your problem as a caching issue.
First reload your cache by holding CTRL and pressing F5.
Second, reload your CSS cache by holding SHIFT and clicking on the borwser's refresh icon.
This should correctly restore your broken images.
Hope this helps! :)
You can try doing Empty Cache and Hard Reload.
For chrome,
1. Open Inspect interface
2. Right click on refresh icon and select the Empty Cache and Hard Reload option
You can also check if your image link is correct. Sometime placing a "/" before the link solves it.
I hope it helps

Should JavaScript/jQuery objects disappear when download hyperlink is clicked

We use Atalasoft's web image viewing SDK to display TIF images in a web page. We recently upgraded to their client-side, JavaScript/jQuery based component and discovered some odd behavior. After initializing the control, if a link is clicked to a resource that should be downloaded, the control(s) clear themselves out. The issue exists in Chrome and IE 11 that I have tested.
Since it is a paid SDK, the easiest way to test this is to go to their demo at:
http://www.atalasoft.com/demos/dotimagewebdemo/
Once the page finishes loading, open a developer console and paste in the following (simply adds a download link to a file on their site):
$("body").append($("<div style='position:absolute;right:5px;top:5px;'><a href='/Gallery/WebViewingDemo.zip'>DOWNLOAD</a></div>"))
Clicking the download link will wipe out their controls on the page.
Adding download to the anchor tag resolves the issue in Chrome, but not IE.
Adding target='_blank' resolves the issue in both, but creates an ugly blank window first (that in my experience does not always close).
I am setting headers server-side to tell the browser to download the file rather than displaying it.
I guess my questions are two-fold:
Is it normal for JavaScript/jQuery based objects to disappear/destroy/whatever when a link is clicked to download a file or is this a problem with their implementation?
and
What is the best solution for this (preferably without the blank page showing up)? We need to support mainly Chrome, FF, and IE (most popular desktop versions).
Thanks in advance!

Why isn't Google Chrome reloading my scripts?

So, I have a script called "engine", and after much headbashing and (futile) debugging, I've found out that GC simply isn't reloading it!
This is how I include it in the webpage (inside the <head> element):
<script type="text/javascript" src="engine.js"></script>
When a put 10 console.log("asdf");'s at the start of the script, it's like they aren't there. When I went to the "resources" tab in the GC console, I saw that no changes are being applied whatsoever to that script! Hlep? Would putting a + "?" + new Date() at the end help?
The universal solution that works in Chrome, Firefox and IE is cleaning the cache via Ctrl+Shift+Del (on Mac ⌘+Shift+⌫).
Chrome solution #1
Open Developer Tools (F12 or ⌘+⌥+i, or right-click → Inspect).
Select the Network tab and tick the Disable cache checkbox.
Reload the page.
❗️Note: The cache will be disabled only when the devtools window is open.
Chrome solution #2
This only makes sense if #1 is not used.
Open Developer Tools.
Click the Settings cogwheel icon in the bottom right corner.
In the dialog that appears, select under the Network subsection the Disable cache checkbox: from now on the cache will be skipped when the devtools window is open. When the devtools windows is closed caching will work as usual.
Chrome solution #3: empty cache + hard reload
Open Developer Tools (otherwise the menu in the next step won't show).
Click and hold down the Refresh button, and then select from the dropdown Empty Cache and Hard Reload.
Modifying javascript code
A browser-agnostic solution which could be used for debugging is to append in your server-side code a randomly-generated version string as a query parameter, i.e. call your script as:
<script type="text/javascript" src="myscript.js?ver=12345"></script>
This trick will force the browser to reload the script when the value of the ver parameter changes. If you make ajax requests then you can append "?ver=" + new Date().getTime() to your URL.
NOTE: Don't forget to remove the parameter when you are finished debugging because in production you most likely do want the scripts to be cached. It is a common practice though to generate a new timestamp on each new build — this can be used in production, and will ensure that after a new deployment the clients will always get the updated scripts.
Unlike all the above solutions this one will work even when you have some sort of caching (e.g. redis, memcached, varnish) or CDN (e.g. akamai, cloudflare, cloudfront, etc) between the client and the server.
It is possible that the script is cached so the old version is loading from cache. If you want to make sure you get a new version, you can force a browser reload, clear your browser cache or change the name of the script or put a different query parameter on the end of the filename.
This bugged me as well; CTRL+F5 or SHIFT+F5 never worked...
The only things that works is opening your dev tools (hit F12), and right-click the reload icon next to the address bar and then selecting either "Hard Reload" or "Empty Cache and Hard Reload"
As I said in the comment I guess it's a cache problem, a CTRL+F5 should be enough, in case it is not go for CTRL+SHIFT+CANC and clear browsing data. However sometimes it's the server that has some kind of cache, I say that because with IBM WebSphere I often get cache problems that I can't resolve with a simple F5 on my browser. I just have to wait for my web server to "refresh" itself.
In the latest chrome stable 21st Oct 2016.
Open Developer Tools (F12 or right-click > Inspect or vertical ellipsis icon in address bar right corner > More Tools > Developer Tools).
Click the vertical ellipsis icon in the top right corner of Developer Tools navigation bar > settings.
In the Preferences section find the Network > Disable cache.

What's the difference between F5 and Ctrl-F5 in Firefox related to JavaScript events?

When you try this public page: http://slim.nl/shop/default.aspx (update: meanwhile this site has changed such that this question's behavior cannot be tested anymore there), you'll notice a menubar. If you hit F5, the menu in that bar disappears. Same when you come to that page via the Back-button in your browser. It only happens on Firefox (seen on versions 3-7). Using Ctrl-F5, the menubar reappears.
To the best of my knowledge, all JavaScript events that fire when loading a page, including any AJAX cycles, should also fire when refreshing a page with F5 or coming there via the Back-button. What's happening here?
I'd like to know from a programmer's standpoint what the difference is between F5 and Ctrl-F5, preferably more general than just this case. Unless it's a bug in Firefox, of course.
Ctrl+F5 clears the cached files in browsers where as F5 just refreshes the page but it uses cached files. Eg say you load a page make changes to a css file and upload it press refresh or F5. Page just refreshes and doesn't fetch the new revised css file hit ctrl+F5 it goes it clears the cache for the page and fetches the file again from the server. This would then load the new css file which would display the changes.
Firefox caches not only loaded files but changes made to page( user input and even changes to attributes made by JavaScript). Check this. So if your menu depends on some attributes you can just hard-refresh by clicking CTRL+F5.
ctrl+F5 will just force the cache to be ignored. Perhaps you have a subtle asynchronous-programming bug that is only surfaces when you have a faster page load (due to using the cache).
That issue was fixed by rolling-back \js\dnn.controls.dnnmenu.js file to previous version. Not sure what was wrong there(didn't have time to debug), but anyway now it works:)

Safari seems to cache the page and the DOM state

I've written a Greasemonkey javascript that works fine in NinjaKit the new Safari userscript manager, but when I try and compile the same script using the Safari 5 extension builder I get some very weird behavior.
The script gives the user an options editing screen, when you click the save button, the script saves the users preferences as a JSON packet via the HTML5 localstorage API, the script then closes the options screen and reloads the page, on the page reload, the script should reload the preferences from the JSON in localstorage, and the script should act on the new preferences to display the page the way the user wants it according to the settings they made.
The problem I am seeing is when I run it as an extension, when I click the save button, the script reloads the page, but when the page is reloaded the changes the user made to the settings do not get applied to the page. the weird part is, if I then manually reload the page again via the browsers refresh button, the changes the user made in the settings do all of a sudden become apparent. so obviously the data has been saved to the localstorage, but for some reason when the page reloads for the first time, it's somehow being reloaded from a cached file, and only on the second manual reload, is the new page displayed correctly. I can't understand why this works as a plain userscript in ninjakit, and also actually works in Firefox, Opera and Google chrome, it just wont work as an extension in safari, its soooo annoying. I've tried lots of ways to make sure that Safari 5 doesn't reload a cached page, e.g adding extra parameters to the URL, but I just can't get it to work, without having to reload the page twice.
BTW I'm not using the native safari extension settings system as I want the script to be cross browser compatible, so that's why I'm saving the settings to localstorage.
Has anyone else witnessed this behavior? Or got any clues how to fix this? It's driving me mental...
i managed to solve the problem though i didnt figure out exactly what was causing it.
i got the script working by adding it as an "end script" rather than a "start script" in the extension builder, it all seems to work fine now. phew!

Categories

Resources