编程清晰浏览器缓存/历史 [英] Programmatically clear browser cache/history

查看:164
本文介绍了编程清晰浏览器缓存/历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的活动我送的意图浏览器以显示网页:

During my activity I'm sending an intent to the browser in order to display a webpage :


    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://ww.mywebpage.com");
    startActivity(i);

我需要确保发送意图的浏览器缓存和历史记录之前被清除,以便页面从服务器直接加载,而不是从电话。

I need to make sure that before sending the intent the browser cache and history are cleared so that the page get loaded from server directly and not from phone.

到目前为止,我已经找到了2下,但我不知道他们是正确的:

So far I've found the 2 following but I'm not sure they are used correctly :


    Browser.clearHistory(getContentResolver());
    Browser.clearSearches(getContentResolver());

另外与缓存没有被清除。

Also with that cache is not cleared.

你知道该怎么做?

推荐答案

首先,我们假定你是只有一个Web浏览器为Android。你错了,而且会越来越误认为随着时间的推移。钢铁,海豚,Opera等已经在生产Android和Mozilla的Fennec的是很好的磨磨蹭蹭。该解决方案不会帮助你与其他浏览器。

First, you are assuming there is only one Web browser for Android. You are mistaken, and will be increasingly mistaken over time. Steel, Dolphin, Opera, etc. are already in production for Android, and Mozilla's Fennec is coming along nicely. This solution will not help you with other browsers.

第二,如果浏览器被错误地缓存你的数据,你的问题可能是服务器(即,不发送适当的缓存控制头)上。我会尝试修复它在那里,所以它的行为正确地在所有浏览器。

Second, if a browser is incorrectly caching your data, your problem is probably on the server (i.e., not sending proper cache control headers). I'd try to fix it there, so that it will behave properly across all browsers.

三,擦了用户的整个历史和搜索,以满足您的需求,是相当不专业。你会怎样想一些桌面应用程序扫除你的桌面浏览器的历史记录和搜索?

Third, wiping the user's entire history and searches, to satisfy your requirements, is rather unprofessional. How would you like some desktop app wiping out your desktop browser's history and searches?

四,您不能清除编程浏览器的缓存。

Fourth, you cannot clear the browser's cache programmatically.

这篇关于编程清晰浏览器缓存/历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆