Closed Bug 1410900 Opened 3 years ago Closed 2 years ago

Need equivalent of CTRL-F5 for a frame

Categories

(Firefox :: Menus, enhancement, P1)

56 Branch
enhancement

Tracking

()

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: f2424880, Assigned: jaws)

References

()

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823

Steps to reproduce:

There doesn't appear to be any way to do a full, cache-bypassing refresh of a frame or iframe from the Firefox UI.

There is:  Right-click --> This Frame --> Reload

...but that's a standard reload, equivalent to F5, not CTRL-F5.

There ought to be a "Reload (bypass cache)" option (or similar) in the same Right-Click --> This Frame menu.

This is important for sites that (a) use frames, and (b) have frame content that needs to be navigated to after page load (hence that won't show up after a CTRL-F5, and won't be refreshed by it).

I develop a website (private access, unfortunately, I can't give a link) that uses frames in this manner:  It has a "navbar" frame and a "content" frame, and always opens with the "content" frame showing a welcome page, so CTRL-F5 can't in general refresh the contents of the "content" frame.

If I update a .js or .css file, I sometimes need to resort to hacks like "Open frame in new tab" and then doing a CTRL-F5 on that tab (which works for me at the moment, but some web pages might actually redirect if not opened in a frame, so it's not a universal solution).  Or, I can directly navigate to the URL of the .js or .css file, and CTRL-F5 it. Neither solution is simple and easy to instruct my client to do, if they encounter a stale-cache issue.

Can force-reload (bypass cache) functionality please be added to the frame context menu?
Severity: normal → enhancement
Component: Untriaged → Menus
Since you are looking at a developer feature, I would recommend you open the Developer Tools (Ctrl+Shift+I on Windows), then go to the Network tab and check the "Disable cache" checkbox.
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
It's not a developer feature!

I need to be able to tell my client:  "I've made some changes, you need to go ahead and force-refresh the frame to see them if you're having problems."

These are NOT technical people, and I cannot ask them to open developer tools and disable the cache!
(Besides, I definitely DON'T want them to disable the cache, just refresh stale content).

There's a good reason CTRL-F5 (or SHIFT-Reload) is a simple key combination, and not also buried in developer tools.
It needs an equivalent for frames, that's all.
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Will asking the user to force-refresh the whole page work? It is very difficult to explain to the common user the difference between a frame and the surrounding web page.
Flags: needinfo?(f2424880)
I'll note that there are also other ways of you as the developer to cause the cache not to get hit when the user refreshes their page. For example, you could add a query string to the end of the URL and change that query string each time you post an update to the page. The browser will see the query string has changed and will request the full document again. You could also configure your server to respond with different cache-control headers.
Asking the user to force-refresh the whole page *won't* work because as I mentioned:

"(b) have frame content that needs to be navigated to after page load (hence that won't show up after a CTRL-F5, and won't be refreshed by it)."

Specifically in my case, if you refresh the whole page, the iframe content always goes back to it's "welcome page", so you just can't refresh it that way.

My pages are arranged with one iframe containing navigation "tabs", and the other has the main content.  So when they're having stale-cache issues with a particular "tab page", I'd like to just tell my users to "Right-click in the so-and-so tab, then click This Frame --> Reload Frame From Server".  They don't need to understand anything technical about frames to do that - the frame in question fills the whole screen except for a nav bar at the top.

And yes, I'm well aware I could use querystrings or appended version numbers on the files to obviate the problem, but in my case I don't think the added complexity is worth it.  This is a problem that crops up for my client perhaps once every 2-3 months.  A more aggressive cache-expiry strategy might also fix it, but at the expense of less overall cache efficiency.  (I use that strategy on the development/testing server, which gets very little traffic, and is updated very frequently). 

I think this is basically the use case that CTRL-F5 is for (for top-level pages), is it not?

Not being able to do the same for a frame is a missing function in Firefox's feature set, and most definitely has a use case; the only workarounds (excluding dev tools) are extremely clumsy:

  * Clearing the *entire* cache

  * Clicking This Frame --> Open in a New Tab, then CTRL-F5 refreshing that tab (and it doesn't work if page script detects it's not in a frame and immediately reloads the top-level page URL)

  * Navigating to the individual URL's of the CSS and JS files that need updating and doing CTRL-F5 for each.


...and I would assume adding in a menu item to do it wouldn't be a difficult thing to do?
Flags: needinfo?(f2424880)
Assignee: nobody → jaws
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(In reply to Dean from comment #5)

Fair enough. We can handle this without introducing a new context menu. The patch I'm attaching will allow the user to press Shift while clicking on the menuitem to bypass the cache.
Also, Shift+click instead of Ctrl+click is used because it matches the same logic we use for the normal Reload contextmenu item.
Priority: -- → P1
Comment on attachment 8922575 [details]
Bug 1410900 - Allow using shift-click on the Reload Frame context menuitem to skip the cache when reloading the frame.

https://reviewboard.mozilla.org/r/193680/#review200884

The general approach seems good and it works on my machine, but see below comment.

::: browser/base/content/nsContextMenu.js:841
(Diff revision 1)
> +    // This applies the same logic as BrowserReloadOrDuplicate
> +    // to determine if the cache should be skipped.
> +    let metaKeyPressed = AppConstants.platform == "macosx"
> +                         ? aEvent.metaKey
> +                         : aEvent.ctrlKey;
> +    var backgroundTabModifier = aEvent.button == 1 || metaKeyPressed;

In BrowserReloadOrDuplicate, isn't this whole backgroundTabModifier business used to prevent force reloading when the user actually meant to open the site in a new tab (which is what cmd + reload does)?

That is, can't you just say

let forceReload = aEvent.shiftKey;

and ignore the rest?

::: browser/base/content/nsContextMenu.js:842
(Diff revision 1)
> +    // to determine if the cache should be skipped.
> +    let metaKeyPressed = AppConstants.platform == "macosx"
> +                         ? aEvent.metaKey
> +                         : aEvent.ctrlKey;
> +    var backgroundTabModifier = aEvent.button == 1 || metaKeyPressed;
> +    var forceReload = aEvent.shiftKey && !backgroundTabModifier;

Nit: use let here and above
Attachment #8922575 - Flags: review?(jhofmann)
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #8)
> Also, Shift+click instead of Ctrl+click is used because it matches the same
> logic we use for the normal Reload contextmenu item.

Thanks Jared.  That sounds perfect.
BTW Does the menu text change when SHIFT is held down, to indicate the change in operation?
(It isn't necessary perhaps, but it ideally would be better if it did).
(In reply to Dean from comment #10)
> (In reply to Jared Wein [:jaws] (please needinfo? me) from comment #8)
> > Also, Shift+click instead of Ctrl+click is used because it matches the same
> > logic we use for the normal Reload contextmenu item.
> 
> Thanks Jared.  That sounds perfect.
> BTW Does the menu text change when SHIFT is held down, to indicate the
> change in operation?
> (It isn't necessary perhaps, but it ideally would be better if it did).

Unfortunately we can't change the text of popups on OSX after they have been opened and displayed to the user due to platform constraints. I'd rather keep the implementation the same for all platforms so we don't have weird bugs related to what is expected and unexpected when using the feature.
Comment on attachment 8922575 [details]
Bug 1410900 - Allow using shift-click on the Reload Frame context menuitem to skip the cache when reloading the frame.

https://reviewboard.mozilla.org/r/193680/#review206134

Looks good, thank you!
Attachment #8922575 - Flags: review?(jhofmann) → review+
Pushed by jwein@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/204d5d38b5ef
Allow using shift-click on the Reload Frame context menuitem to skip the cache when reloading the frame. r=johannh
https://hg.mozilla.org/mozilla-central/rev/204d5d38b5ef
Status: ASSIGNED → RESOLVED
Closed: 3 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
You need to log in before you can comment on or make changes to this bug.