16

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.

enter image description here

Abel
  • 56,041
  • 24
  • 146
  • 247
  • Well I can't reproduce, but I'm pretty sure there's no difference JavaScritp wise. It's supposed to refresh the page without taking into account what's in the cache. – Alex Turpin Oct 14 '11 at 13:42
  • @Xeon06: so far I've had a couple of users (including myself) repro the issue (but I would like to hear of other independent repro's too). One difference I do know is that F5 does not refresh linked links (images etc), Ctrl-F5 does, which is why their load speed is so different. – Abel Oct 14 '11 at 13:45
  • 1
    I can reproduce it alright, but the same ajax event fire when you refresh or navigate through the site, I would suggest debuging your code, since it's probably a logic issue. – Deleteman Oct 14 '11 at 13:46
  • #deleteman: I'm trying to get my hands around the "logic" here. I can debug, but there are no errors and the page does not physically change between loading and F5, or so I thought. So where to start a debug if two situations are equal? – Abel Oct 14 '11 at 13:48
  • 1
    I cna replicate it as well. I'm using Firefox 3.6.17 – Alistair Laing Oct 14 '11 at 13:57
  • @Abel I would suggest just setting a break point at the start of the process and then go step by step, it can be a pain, but it'll show you exactly what happens. Good luck! – Deleteman Oct 14 '11 at 14:03
  • @Abel: I was able to reproduce this in Firefox 7.0.1 – gen_Eric Oct 14 '11 at 14:25
  • @Abel: It looks like its working in FF but I get js errors in IE7. – Alistair Laing Oct 14 '11 at 14:35
  • @AlistairLaing: not sure about their policy, but I believe they don't support older browsers too well, so I'm not too surprised about IE7. Try IE8 or IE9. – Abel Oct 14 '11 at 16:02
  • @Deleteman: the request is never made, so setting a breakpoint is useless, because no code is run. – Abel Oct 14 '11 at 16:03

4 Answers4

14

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.

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
Alistair Laing
  • 983
  • 1
  • 7
  • 18
  • 1
    Indeed, this difference is what I thought I knew. How does that explain the difference in behavior though, only in FF? – Abel Oct 14 '11 at 13:49
  • It is very peculiar. Could it be a JQuery Ajax issue? try and set the ajax call to no store the cache – Alistair Laing Oct 14 '11 at 13:59
  • @Abel I know jQuery did some major changes to .ajax. Coudl you try a more recent version? – Alistair Laing Oct 14 '11 at 14:02
  • Thanks for the ideas. We upgraded jQuery to the latest version, but it didn't help (their tries cannot be seen on the live site as that is out of our reach, but we tried in the acceptance env). – Abel Oct 14 '11 at 16:14
11

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.

Community
  • 1
  • 1
Vasiliy Shiryaev
  • 600
  • 4
  • 12
  • 1
    That is indeed an actual difference, also as compared to other browsers. And it gives me a pointer for where to look for this behavior. Though the link you gave seems on an unrelated subject, it begs the question, what else is cached by FF. – Abel Oct 14 '11 at 16:07
2

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).

hugomg
  • 68,213
  • 24
  • 160
  • 246
  • 1
    The difference in speed could be an argument, but when you get to the page by a link (Home, for instance), the page is loaded equally fast as by an F5, because the cache is used. However, this way, the menu does not disappear. – Abel Oct 14 '11 at 13:54
0

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:)

Community
  • 1
  • 1
Andy
  • 429
  • 3
  • 9