Get current page http status from javascript

前端 未结 3 611
难免孤独
难免孤独 2020-12-01 13:20

Is there any way to get the http status of the current web page from javascript?

Spent some time searching on the web, but no luck at all... Seems like it\'s not pos

相关标签:
3条回答
  • 2020-12-01 13:57

    This is not in any way possible, sorry.

    0 讨论(0)
  • 2020-12-01 14:22

    you can only check status of page loading try:var x = document.readyState; The result of x could be: One of five values:

    uninitialized - Has not started loading yet
    loading - Is loading
    loaded - Has been loaded
    interactive - Has loaded enough and the user can interact with it
    complete - Fully loaded
    
    0 讨论(0)
  • 2020-12-01 14:22

    It is not beautiful, but you can use:

    t = jQuery.get(location.href)
        .success(function () { console.log(t.status) })
        .error(function()    { console.log(t.status) });
    
    0 讨论(0)
提交回复
热议问题