当启用优化时从捆绑中渲染样式时,您会得到以下信息:
<link href="/Content/themes/base/css?v=UM624qf1uFt8dYtiIV9PCmYhsyeewBIwY4Ob0i8OdW81" rel="stylesheet" type="text/css" />
不幸的是,Android浏览器似乎在它们上没有load urls with query strings。有什么方法可以在System.Web.Optimization中自定义此字符串?编辑:
My question is answered and I tried to detect android on user agent string and replace with a querystring less link to the stylesheet. Apparently the problem I had wasn't because of the querystring, it was minified version of the webfont css that was causing it not to load the stylesheet completely in the Android stock browser.
Android stock browser fails to load css content string with escaped backslash which was a workaround for the ASP.NET minifier that erronously minifies the same css content string. I ended up putting the icon font css styles on it's own "minified by hand" stylesheet.
最佳答案
目前,我们不支持自定义版本字符串在url中的显示方式。
这是我们的Codeplex网站上的问题的链接:Url version issue
同时,如果您愿意每次更改包时都手动修改包路径,则可以避免使用帮助程序,而只需拥有指向您包的显式链接,即可在每次包更改时对其进行更新:
<link href="/Content/themes/base/css" rel="stylesheet">
或者您可以通过
bundle.Cacheability = HttpCacheability.NoCache
禁用客户端上的缓存
关于asp.net-mvc - 在system.web.optimization中自定义缓存清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15290488/