简体   繁体   English

Android Webview显示旧网站内容而不是新网站内容

[英]Android webview showing old website content instead of new

I am having an issue with webview not fetching fresh pages of my website. 我的webview出现问题,无法获取我网站的新页面。 I did some thorough search and tried many different techniques but it didn't work till I found this code; 我进行了彻底的搜索,并尝试了许多不同的技术,但直到找到此代码,该方法才起作用。

<link rel='stylesheet' href='style/jquery.mobile-1.3.2.min.css?ver=1.3.2'>
<script src="js/jquery-1.8.3.min.js?ver=1.8.3"></script>
<script src="js/jquery.mobile-1.3.2.min.js?ver=1.3.2"></script>
<script src="js/my_script.js?ver=201603111428"></script>

which simply says to add a new version number to my css etc whenever I make changes and it will load properly on my webview. 简单地说,就是每当我进行更改时,向我的CSS等添加新的版本号,它将正确加载到我的Web视图中。 Shockingly it worked but I have a feeling this shouldn't be the way to go about it, so I wanted to find out if there's a working script I can just add to my webview to make it load the online content each time not cached content? 令人震惊的是它起作用了,但是我感觉这不应该成为解决问题的方法,所以我想找出是否有一个可以正常工作的脚本,我可以将其添加到我的Web视图中,以使其每次都在不缓存内容时加载在线内容?

Thank you for the help. 感谢您的帮助。

The part after ? 之后的部分? character represents actually a log for the changes you made. 字符实际上代表您所做更改的日志。

These docs should help you understand better why https://semver.org/ 这些文档应该可以帮助您更好地理解为什么https://semver.org/

This is a good way and a preferred, it can be a simple hash number or an increment or a timestamp as long. 这是一种好方法,也是首选方法,它可以是一个简单的哈希数,也可以是一个增量或一个时间戳。 But it must mark that the version the browser has cached changed. 但是它必须标记浏览器已缓存的版本已更改。 For that, we append that additional info in the name. 为此,我们在名称中附加了该附加信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM