window.controllers is deprecated. An alternative?

Using

window.location.href = “mailto:” + strMailto;

will throw on the console:

window.controllers is deprecated. Do not use it for UA detection.

Also the msg is thrown, a compose window is opened with the mailto address given with ‘strMailto’.
I tried to find an alternative, but Dr.G doesn’t give one for that. Any idea how to replace the “window.location”?

This is on Thunderbird:
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Based on this: https://stackoverflow.com/questions/27368537/firefox-window-controllers-is-deprecated-do-not-use-it-for-ua-detection/31768275

It seems like this may not be an issue with your code but with an extension you may have installed instead :slight_smile:

Basically there is no concrete answer afaiu!?
The error is thrown with calls like "location.href = "mailto:" + addrString" and no alternative around!
Open to learn more …

There is nothing wrong with your code. When I tried in a Firefox build and ran the same lines, I didn’t receive that error. My guess is that this error is being caused by something else in your browser like the extension that the StackOverflow thread discusses.

Here is what my code looks like:

location.href = "mailto:" + "[email protected]"
"mailto:[email protected]" // what gets called. My mail app launches.

That’s a good thing, for location.href is really useful. There isn’t any alternative to it on the table haha.

Just for completeness:
Starting Thunderbird in safe mode (which disables all extensions!) and excecuting the location.ref as mentioned will throw that “window.controllers is deprecated.” also!
So it seems to be a general situation, maybe not a problem … but good to know and probably there is no alternative … some what strange …