What steps can be taken to ensure that an asset CSS file does not get cached in a custom backend module?

I have come across this piece of code for embedding custom css in my custom BE module extension.

<f:asset.css identifier="myextcss" href="EXT:myExt/Resources/Public/Css/myext.css" />

While it works well, the browser caches this file. How can I prevent it from being cached? I am aware that pages can be set as non-cachable in FE, but in BE I only want to prevent this specific file from caching, not the entire module.

Answer №1

After experimenting for a bit, I discovered a clever solution.

I inserted the following lines into my controller:

$myKey = substr (str_shuffle($_GET['key']),0,8);
$this->view->assign('myKey', $myKey);

Then, in my fluid template, I added this code:

<f:asset.css identifier="customCss" href="EXT:customExt/Resources/Public/Css/custom.css?{myKey}" />

This way, the browser always detects a "new" file request and refreshes it.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I keep a button element in place when resizing the window using CSS?

I'm currently experiencing an issue with my navbar where a button escapes from it when I resize the screen. Which CSS property should I modify to ensure that the button remains inside the navbar and doesn't escape? Here is a JFiddle link demonst ...

CSS pixel movement problem causing the page to shift a few pixels before returning to its original position

Encountering a CSS issue, I need assistance. Take a look at this page. When you click on the "Barcelona" link on that page, the entire page shifts 10 pixels to the right and then returns to its original position. Why is this happening? Any solutions or i ...

Adding a border to dynamically generated content while excluding the outer borders using CSS - an easy guide

My current project involves establishing a grid system that dynamically populates content, resulting in an uncertain number of elements being created. At the moment, each element is placed within a flexbox container with 3 elements per row. If there are mo ...

What is the best way to eliminate the underline from a hyperlink?

I need help removing the underline from links on a website. I attempted to use "text-decoration: none;" but it didn't work. Could someone point out what syntax mistake I made? Or perhaps suggest a better way to eliminate the underline? <head> ...

Position the vertical bar directly adjacent to the form input field

Looking for assistance with creating a unique webpage layout that includes a form where the employee ID is visually separated from the rest of the content by a vertical bar extending across the entire page. However, my attempts to achieve this using a gr ...

Troubleshooting a CSS Problem with Safari

I am experiencing an issue where a box with a hover overlay does not display correctly on Safari browsers (desktop and mobile). The styles such as width, height, and padding are not applied properly initially. Oddly enough, when I toggle these styles off a ...

Tips for resolving the final item issue in Owl Carousel when using right-to-left (RTL)

Encountering a bug with the rtl setting in owl-carousel. When the rtl is applied to the slider and I reach the last item, the entire slider disappears! Here's the code snippet: var viewportWidth = $("body").innerWidth(); if (viewportWidth & ...

"Triggering an event after selecting and opening a file with an input of type file

Check out this snippet of HTML code: <input type="file" id="mysignature_upload" onChange="readURL();"/> We also have some Javascript code: function readURL(){ alert("Hello"); } A potential issue with this code is that the function readURL is on ...

Chrome now supports clickable circular canvas corners

I have a unique setup with two canvases. I've customized them to be circular by utilizing the border-radius property. The second canvas is positioned perfectly within the boundaries of the first one using absolute positioning. This is where it gets e ...

Extend the background of the left sidebar completely to the left side

I'm working on a website with a fixed 960px layout featuring a light-gray sidebar and white background. I am aiming to center the content within the layout, but I need help figuring out how to make the sidebar background extend all the way to the left ...

Collapse dropdown menus upon clicking outside of them

As a newcomer to coding, I'm trying to figure out how to create multiple dropdown menus where each one collapses when you click outside of it. I've been struggling with the code I wrote for weeks now - I want to have 3 dropdown menus but only one ...

The form model does not display the form again if the form is invalid

After adding Min and Max Value validators to my Django model, I encountered an issue where entering a value out of the specified range resulted in a ValueError being raised instead of re-rendering the form. The specific error message was: "ValueError: The ...

Check for compatibility of overflow:scroll with mobile browsers

Is there an easy JavaScript method that works across different devices and libraries? I am looking to assign a class to the html element in order to enable scrollable containers on mobile devices when needed. I want to follow a similar approach to Modern ...

unique close button design for pop-up video player on YouTube

Struggling to add a custom close button to my Youtube video pop up. After unsuccessful research attempts, I'm turning to my fellow stack buddies for help. Any suggestions? ...

Is there a way to shift this structure to the right without relying on the float property?

Here's the HTML and CSS I have - .font-size-add-class { background-color: #2f2f2f; color: #f9f7f1; } .font-sizes { text-align: right; display: table; margin-top: 15px; cursor: pointer; } .font-sizes > .small { font-size: 12px; } .font ...

"Finding specific data on a list with ease - A guide to scrolling using a searchbox

One interesting feature of my project is the search box that allows users to quickly find specific data in a populated div list sourced from the database. When a user types something into the search box, the corresponding data will be scrolled to on the li ...

"Revamp Your CSS Styles with RTLCSS and Elevate Your Vue Js Project

Because Element Plus does not support Right-to-Left (RTL), I had to utilize third-party libraries such as the rtlcss plugin to address this issue. However, in my application where both RTL and Left-to-Right (LTR) directions are used, the rtlcss plugin alwa ...

Click a button to adjust the height of an element

My webpage features a dashboard with tabs on the left and corresponding content on the right. To ensure proper alignment, I have utilized Bootstrap to create two columns - one for the tabs and one for the content. However, I am facing an issue where the bo ...

Retrieve the text content of the paragraph element when its parent is clicked. The paragraph element belongs to a group that contains many

In a function I'm working on, I need to retrieve the specific text within a p element when its parent (.photoBackground) is clicked. The purpose of this operation is to grab the caption for a gallery, where there are multiple p elements with the same ...

Material-UI organizes its Grid Items vertically, creating a column layout rather than a horizontal row

I'm struggling to create a grid with 3 items in each row, but my current grid layout only displays one item per row. Each grid item also contains an image. How can I modify the code to achieve a grid with 3 items in a row? Here's the code snippet ...