状态码304(翡翠,节点,Express) [英] Status code 304 (Jade, Node, Express)

查看:62
本文介绍了状态码304(翡翠,节点,Express)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在我的jade文件中链接bootstrap和jquery,

I'm linking bootstrap and jquery in my jade file,

link(rel='stylesheet', href='/stylesheets/bootstrap.css')

script(src='/javascripts/jquery-3.1.1.js')
script(src='/javascripts/bootstrap.js')

这个Jade文件在我的views文件夹中.boostrap css在我的public/stylesheets文件夹中,而javascript在public/javascripts文件夹中.

This Jade file is in my views folder. The boostrap css is in my public/stylesheets folder and the javascript is in the public/javascripts folder.

当我使用nodemon运行应用程序时,它会显示

When I run my application using nodemon, it says

GET / 200 80ms - 1.65kb
GET /stylesheets/bootstrap.css 304 1ms
GET /javascripts/jquery-3.1.1.js 304 3
GET /javascripts/bootstrap.js 304 2ms

javascript和css文件无法加载.

The javascript and css files do not load up.

建议?

推荐答案

304未修改

如果客户端执行了有条件的GET请求,并且访问权限为允许,但文档尚未修改,服务器应回应此状态码.304响应中不得包含message-body,因此总是由第一个空行终止标题字段之后.

If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.

服务器向客户端(浏览器)发送了 304 http 状态,以通知该文件自浏览器上次收到该文件的副本以来未进行任何修改> 200 状态代码.发生这种情况时,通常浏览器应具有文件的缓存副本,并将从 cache 加载相同的文件.

Server sent 304 http status to the client (browser) to let it know the file is not modified since the browser last received the copy of the file with 200 status code. When this happens, usually browser should have cached copy of the files and will load the same from the cache.

最好通过删除所有临时文件,历史记录等,清除所有浏览器的 cache ,然后关闭并重新打开(重新启动)浏览器.

Better, clear all your browser cache by deleting all temporary files, histories etc and close and reopen (restart) your browser.

重新加载页面,然后在 nodemon 中再次检查状态码.这次应该是 200 .

Reload the page and check the status code again in nodemon. It should be 200 this time.

这篇关于状态码304(翡翠,节点,Express)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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