# window.controllers is deprecated. An alternative?

**URL:** <https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233>\
**Category:** web dev\
**Created:** [September 28, 2017, 1:05pm UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233 "2017-09-28T13:05:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gNeandr](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gNeandr](https://forum.kirupa.com/u/gNeandr)\
**Post date:** [September 28, 2017, 1:05pm UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233/1 "2017-09-28T13:05:45Z")

</div>

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_

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 1, 2017, 5:24pm UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233/2 "2017-10-01T17:24:29Z")

</div>

Based on this: [https://stackoverflow.com/questions/27368537/firefox-window-controllers-is-deprecated-do-not-use-it-for-ua-detection/31768275](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 🙂

---

<div class="post-metadata">

**Author:** ![gNeandr](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gNeandr](https://forum.kirupa.com/u/gNeandr)\
**Post date:** [October 1, 2017, 9:35pm UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233/3 "2017-10-01T21:35:03Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 2, 2017, 12:33am UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233/4 "2017-10-02T00:33:41Z")

</div>

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:" + "kirupa@kirupa.com"
"mailto:kirupa@kirupa.com" // 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.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gNeandr](https://forum.kirupa.com/u/gNeandr)\
**Post date:** [October 2, 2017, 10:39am UTC](https://forum.kirupa.com/t/window-controllers-is-deprecated-an-alternative/637233/5 "2017-10-02T10:39:33Z")

</div>

_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 …
