Javascript 文件未在本地主机上更新

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25723801/
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-08-22 21:46:15  来源:igfitidea点击:

File not updating on localhost

javascriptjsonvisual-studio-2010localhost

提问by Joakim M

I am pulling my hair here. I think I am falling into som really basic stuff but here is my error. I have built a simple webpage with the following "tree-view".

我在这里拉我的头发。我想我陷入了一些非常基本的东西,但这是我的错误。我用以下“树视图”构建了一个简单的网页。

enter image description here

在此处输入图片说明

in my readjson.js I read from my json-file stored in json/label.json. However!

在我的 readjson.js 中,我从存储在 json/label.json 中的 json 文件中读取。然而!

Even if I have updated my json-file it reads the FIRST version of the json-file when I started. Using Google Chrome and have tried to refresh the browser, clean my build an so on. Still wont update the json-file on localhost.

即使我更新了我的 json 文件,它也会在我开始时读取 json 文件的第一个版本。使用谷歌浏览器并尝试刷新浏览器,清理我的构建等等。仍然不会更新本地主机上的 json 文件。

Have anyone else run into this and how do I solve it?

有没有其他人遇到过这个问题,我该如何解决?

回答by Mr. Brown

Have you tried to bring up the developer console (ctr shift j) and right click on the refresh icon using the "Empty Cache and Hard Reload" option?

您是否尝试过打开开发者控制台(ctr shift j)并使用“清空缓存和硬重新加载”选项右键单击刷新图标?

回答by Karmidzhanov

Ctrl + Shift + Del-> Clear all cached data*

Ctrl + Shift + Del->清除所有缓存数据*

Then Ctrl + F5should be enough.

然后Ctrl + F5应该就足够了。

EDIT: *In the newer versions of browsers clear only files and images cache.

编辑:*在较新版本的浏览器中,清除文件和图像缓存

回答by Ulf Aslak

On Mac you right click the reload button and click "Empty Cache and Hard Reload". Sometimes, though, it's enough to just do a "Hard Reload" (cmd + shift + R).

在 Mac 上,您右键单击重新加载按钮,然后单击“清空缓存和硬重新加载”。但是,有时只需执行“硬重新加载”( cmd + shift + R)就足够了。

回答by Karsiyakali

Right click on console and clear console history and right click on refresh button on your browser and hard reload.

右键单击控制台并清除控制台历史记录,然后右键单击浏览器上的刷新按钮并重新加载。

回答by Mohamed Arshad

The problem is that Chrome is reading the data from cache files. You should:

问题在于 Chrome 正在从缓存文件中读取数据。你应该:

  1. Clear cookies and cache files.
  2. Reload the page.
  1. 清除 cookie 和缓存文件。
  2. 重新加载页面。

It worked for me.

它对我有用。