javascript 三星智能电视如何清除应用缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31578540/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 14:00:11  来源:igfitidea点击:

Samsung smart TV how to clear app cache

javascriptsamsung-smart-tv

提问by san88

I'm developing Samsung smart SDK app. When executing the app its shows previous version content. (my app is running on browser and its keep displaying previous changes that i have done to the app,not the current one) After restarting the TV its shows the latest update.

我正在开发三星智能 SDK 应用程序。执行应用程序时,它会显示以前的版本内容。(我的应用程序正在浏览器上运行,它不断显示我对应用程序所做的先前更改,而不是当前更改)重新启动电视后,它会显示最新更新。

This is my header.

这是我的标题。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0;   maximum-scale=1.0;user-scalable=no">

I did some changes to my Samsung TV App and it is working fine in my browser. But when comparing the defects they have mentioned (from Samsung) are not in my updated version and those are from previous submitted version. I think this should be a cache. I need to ignore this and load fresh one I updated.

我对我的三星电视应用程序做了一些更改,它在我的浏览器中运行良好。但是当比较他们提到的缺陷时(来自三星)不在我的更新版本中,而那些来自以前提交的版本。我认为这应该是一个缓存。我需要忽略这一点并加载我更新的新内容。

采纳答案by ksotik

In addition to the answers above you can:

除了上述答案,您还可以:

  1. Reboot TV
  2. Add ?v= to the script tag for css & javascript files and change the version after every change. This process can be automated through the make system.
  3. Add no-cache headers to HTTP server, e.g. nginx:

    location ~ .*(gif|jpg|jpeg|png|ico|css|swf|js|html|htm)$ { expires 0; }
    
  1. 重启电视
  2. 将 ?v= 添加到 css 和 javascript 文件的脚本标记中,并在每次更改后更改版本。这个过程可以通过 make 系统自动化。
  3. 向 HTTP 服务器添加 no-cache 标头,例如 nginx:

    location ~ .*(gif|jpg|jpeg|png|ico|css|swf|js|html|htm)$ { expires 0; }
    

回答by Gaurav Dave

Try this:

试试这个:

localStorage.clear();

OR

或者

var LocalStorageCache = caph.dal.LocalStorageCache;
var localstoragecache = new LocalStorageCache();

localstoragecache.clearAll();

See, if that helps.

看看,如果这有帮助。

回答by shreeramk

Put this in head of your html file.

把它放在你的 html 文件的头部。

<meta http-equiv="Cache-Control" content="no-store" />