Jump to content

Getting Cannot set property 'timestamp' of undefined on every page


Executable

Recommended Posts

On every page of my website I have this following error in my console.

 

Quote

Uncaught TypeError: Cannot set property 'timestamp' of undefined
    at Object.save (webspeed.js:22986)
    at Object.success (webspeed.js:23012)
    at fire (webspeed.js:3477)
    at Object.fireWith [as resolveWith] (webspeed.js:3589)
    at done (webspeed.js:8664)
    at XMLHttpRequest.callback (webspeed.js:9207)

Quote

webspeed.js:9135 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.speedtest.net/api/connection with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

I don't what is the root of the problem

Sans titre.png

Link to comment
Share on other sites

Looks like you have the speedtest's javascript on the pages and it likely needs to be updated.   Quick fix would be to remove the webspeed.js <script> tags from where they are included in the templates.   That would be custom for your setup, so where that is done at would not be possible for me to say right off without a few guesses.

Edited by steven99
Link to comment
Share on other sites

  • 2 years later...

In JavaScript almost everything is an object, null and undefined are exception. if a variable has been declared, but has not been assigned a value, is automatically assigned the value undefined . Therefore, if you try to access the value of such variable, it will throw Uncaught TypeError cannot set property '0' of  undefined/null .

JavaScript null and undefined is one of the main reasons to produce a runtime errors . This happens because you don't check the value of unknown return variables before using it. If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them.  The standard way to catch null and undefined simultaneously is this:
 

if (variable == null) {
     // your code here.
}

Because null == undefined is true, the above code will catch both null and undefined.

Also you can write equivalent to more explicit but less concise:
 

if (variable === undefined  variable === null) {
     // your code here.
}

This should work for any variable that is either undeclared or declared and explicitly set to null or undefined.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated