javascript - Status code 304 (Jade, Node, Express) - Stack Overflow

I'm linking bootstrap and jquery in my jade file,link(rel='stylesheet', href='styl

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

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

and

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

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.

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

The javascript and css files do not load up.

Suggestions?

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

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

and

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

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.

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

The javascript and css files do not load up.

Suggestions?

Share Improve this question asked Nov 14, 2016 at 6:18 Human Cyborg RelationsHuman Cyborg Relations 1,2446 gold badges27 silver badges57 bronze badges 1
  • 1 304 response indicates that the resource has not been modified. What is wrong with that? – saeta Commented Nov 14, 2016 at 6:28
Add a ment  | 

2 Answers 2

Reset to default 7

304 Not Modified

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.

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.

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

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

To get rid of this status pletely you can add header

res.header('Cache-Control', 'no-cache, no-store, must-revalidate')

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1741175896a4320183.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信