1

我想删除 Android 中的缓存。我正在使用 PhoneGap 技术。实际上,在黑莓或 iOS 中一切正常,但在 Android 中存在问题。在我的应用程序中,有一个自动建议的电台名称列表。用户第一次选择站台时还好,但是下次用户选择同一个站台时,站名显示大字体(白色背景(与我原来的站台列表不同的单个列表),我认为是由于缓存)。

我认为这是由于 Android 使用 Chrome。您能否建议我如何删除此缓存?

<input id="getStationDesc" name="getStationDesc" type="text" class="log_txtfield" disabled="disabled"/>
<script>
    var obj = actb(document.getElementById('getStationDesc'),stationList);
    //setTimeout(function(){obj.actb_keywords = custom2;},10000);
    this.actb_timeOut = -1;
    // Number of elements autocomplete can show (-1: no limit)
    this.actb_lim = 10;
    // should the auto complete be limited to the beginning of keyword?
    this.actb_firstText = true;
    // Enable Mouse Support
    this.actb_mouse = true;
    // Delimiter for multiple autocomplete.
    // Set it to empty array for single autocomplete
    this.actb_delimiter = new Array(' ',',');
    // Show widget only after this number of characters is typed in.
    this.actb_startcheck = 1;

    this.actb_bgColor = '#dbe3ec';
    this.actb_textColor = '#00256a';
    this.actb_hColor = '#dbe3ec';
    this.actb_fFamily = 'arial';
    this.actb_fSize = '16px';   
    this.actb_hStyle = 'text-decoration:underline;font-weight="bold";text-align="left"';
    function FillValues()
    {
        document.getElementById('getStationCode').value = document.getElementById('getStationDesc').value.substring(0,3);               
    }
</script>
4

1 回答 1

1

您可以在 Phonegap 中手动清除缓存。我以前每次都在应用程序加载之前删除应用程序的缓存。试试这个代码,

super.clearCache();
super.loadUrl("file:///android_asset/www/index.html");

如果你愿意,你也可以在应用程序结尾使用。

更新:另一种解决方案,

在你的 actb() 函数之后,调用页面创建,

$("#index").trigger("pagecreate");
/*#index is the id of the page*/
于 2012-09-01T06:37:41.960 回答