UserAgent error

I’m getting this error in the console when my mod nkknkn is embedded on a page:

Uncaught TypeError: Cannot read property 'userAgent' of undefined at anymod.com.toolkit.js:1

for this line of code:

return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())

Is that an internal error or am I doing something wrong?

Hmm I don’t believe we’ve seen that one before. What browser are you using?

Latest Chrome. Not seen it before myself either.

We are looking into this; have not been able to replicate it so far. What OS are you on, and is there anything else you think might be relevant (browser extensions, etc)?

Nothing has changed in my browser or on my site in the last few days.

Here’s a dev link for the site: https://bloomtest.carrd.co

If you don’t see the error in the console it must be something in my browser.

Can you add me to the project? (tyler@anymod.com) The toolkit (pencil editor) doesn’t load for me so I’m not getting the same experience.

Can I invite if I’m on the free plan?

I thought I bumped it so you could – is it saying you can’t?

Yeah - telling me to upgrade. I’ll try signing out and back in.

Signing out/in didn’t make any difference.

Can you try again now. No log out/in needed (page refresh maybe needed though)

Yep- that worked :+1: :+1:

OK great, I’m seeing the error now. We’ll have a look and let you know!

My guess is the line

self = this

in your mod is overwriting the window object at the global level. I think changing it to

let self = this

will fix the issue

Edit

Alternatively, you can use the double arrow for ES6 here:

klasses.forEach(function(klass) {
klasses.forEach(klass => {

And you will be able to use this inside the function block without needing a self variable

1 Like

Changed it to _this and the error went away :+1:

1 Like

Oooh! arrow function, even better! No need for local assignments :tada:

1 Like

Yes it’s very post-modern => :arrow_right:

1 Like