首页 \ 问答 \ 离线缓存(HTML5)(Offline Caching(HTML5))

离线缓存(HTML5)(Offline Caching(HTML5))

我使用HTML 5离线缓存方法从服务器更新缓存信息面临一些困难。

这是步骤列表,

1-创建一个cache.manifest文件,其中包含以下条目

   CACHE MANIFEST 
   # Version 1.0
   CACHE:
   /loading.js
   /images/pan-icon.png
   NETWORK:
   *

然后我开始添加以下事件绑定器以从服务器加载更新的信息

window.addEventListener('load', function (e) {
    window.applicationCache.update();
    window.applicationCache.addEventListener('updateready', function (e) {
        if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
            // Browser downloaded a new app cache.
            window.applicationCache.swapCache();
            console.log('Updated');
        } else {
            console.log('No Update');
        }
    }, false);

}, false);

但它总是无法从服务器获得最新的'loading.js'。 我需要清除缓存以从服务器获取更新。

有没有办法更新这个。

请帮帮我

我正在使用ASP .NET MVC框架来构建我的Web应用程序


I am facing some difficulty to update cache information from the server by using HTML 5 offline caching method.

Here is the list of steps,

1- Created one cache.manifest file with following entries

   CACHE MANIFEST 
   # Version 1.0
   CACHE:
   /loading.js
   /images/pan-icon.png
   NETWORK:
   *

Then i jest add following event binder to load updated information from the server

window.addEventListener('load', function (e) {
    window.applicationCache.update();
    window.applicationCache.addEventListener('updateready', function (e) {
        if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
            // Browser downloaded a new app cache.
            window.applicationCache.swapCache();
            console.log('Updated');
        } else {
            console.log('No Update');
        }
    }, false);

}, false);

But it alwayes failed to get latest 'loading.js' from the server. I need to clear the cache to get update from the server.

Is there any way to update this forefully.

Please help me

I am using ASP .NET MVC framework to build my web application


原文:https://stackoverflow.com/questions/28856327
更新时间:2022-07-05 19:07

最满意答案

memcpy的第三个参数是要复制的字节数。 你提供了int的数量。 改为:

memcpy ( k_src,
&handle->_context._buf[0],
 handle->_context._bufLen * sizeof(int)
);

The third argument to memcpy is the number of bytes to copy. You provided the number of ints. Do this instead:

memcpy ( k_src,
&handle->_context._buf[0],
 handle->_context._bufLen * sizeof(int)
);

相关问答

更多
  • memcpy的第三个参数是要复制的字节数。 你提供了int的数量。 改为: memcpy ( k_src, &handle->_context._buf[0], handle->_context._bufLen * sizeof(int) ); The third argument to memcpy is the number of bytes to copy. You provided the number of ints. Do this instead: memcpy ( k_src, &han ...
  • 对我来说,看起来你只是有一个错字。 这个: thrust::copy_if(t_inputArray, t_inputArray + size, d_outputArray, is_positive()); ^ 应该是这样的: thrust::copy_if(t_inputArray, t_inputArray + size, t_outputArray, is_positive()); 你已经将原始指 ...
  • 感谢大家的帮助。 这个问题最终在main.c出现拼写错误。 就像是: extern struct _infoo info[]; 当typedef替换它们时,一切工作都很好。 Thanks for everybody's help. This question end up with a misspelling in main.c. Something like: extern struct _infoo info[]; When typedef replace them, all work fine def ...
  • 对于你的sizeof(command_table)的工作,它需要看到这个: static struct command command_table[] = { {"help", help_init, help_exec}, }; 但它只看到这一点: extern struct command command_table[]; 看到sizeof()永远不会知道有多少元素实际在那里。 顺便说一句,还有另一个问题。 static使数组在所有其他模块中不可见。 你必须删除它或解决它。 您的选项(删除st ...
  • 只有在您复制的对象是所谓的POD(普通旧数据结构)时, 才允许使用memcpy。 但是你的struct包含不是POD的std :: string对象。 因此,您的整个结构不是POD。 请改用算法标头中的std :: copy。 You are only allowed to use memcpy in case the objects you're copying are so-called PODs (plain old data structures). But your struct contains ...
  • memcpy(inodetable.inodes[0], &rootinode, sizeof rootinode)将起作用。 inodetable是一种struct类型,您无法将其编入索引。 另一个选项是memcpy(&inodetable, &rootinode, sizeof rootinode) ,尽管明确命名成员不那么容易混淆。 但是,您不需要使用memcpy()来复制struct 。 简单的任务将起作用: inodetable.inodes[0] = rootinode; 请注意,这仅适用于s ...
  • 无论struct my_error_mgr是什么,编译器都无法将其声明作为类型找到。 您需要包含具有该声明的标头。 Whatever struct my_error_mgr is, the compiler can't find its declaration as a type. You need to include the header that has that declaration.
  • 您将匿名结构定义为myTasks 。 要声明您的数组,请使用myTasks taskInfo[2500] 。 C认为你正在声明一个新命名的 struct struct myTasks ,并且它不完整,因为你没有定义结构。 但是, myTasks是您已定义的结构的别名。 You typedefed the anonymous struct to myTasks. To declare your array, use myTasks taskInfo[2500]. C thinks you are declar ...
  • 在本地范围内声明变量时(例如在函数体中),您可以执行此操作并且编译器不会抱怨,它将推断出您指的是3个元素的int数组。 void someFunc() { int idk[] = { 1,2,3 }; // Ok, so idk is in fact a int[3]; // Do whatever work... } 当在类或结构声明中执行相同的操作时,编译器不希望为您推导出相同的内容,因此基本上,您需要更严格。 完整的原因,您可以在这里看到( 不能从成员变量中的初始化器字符串中推断出数 ...
  • 使用另一个_buffwrt.flush(); 在循环之外冲洗剩余的东西,不要忘记_buffwrt.close(); 最后 更新 @Svetlin Zarev提到一个好点,只有_buffwrt.close(); 最后将足以清除剩余的任何内容http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#close%28%29 use another _buffwrt.flush(); outside the loop to flush ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)