Question: **EDITED**: THIS WAS A SERVER REDIRECT ISSUE, not sure if question should be deleted.

I'm in a page with valid SSL certificate lets say: 

```
 https://www.example.com/something 

```

I execute this:

```
 window.location = '/other/folder';

```

And the redirection goes to a non SSL version:

```
 http://www.example.com/something 

```

Anyone know why and how to prevent that?

(I want to understand why this happend so dont ask me to just add https:// at the beginnin), Thanks!

Answer: 
This is just a guess, but maybe you are running that code from a JS file that is hosted/sourced via plain http:// and the browser is using that as the relative protocol?

I went to <https://en.wikipedia.org/wiki/Test_cricket> ran `window.location = '/'` in the console and it took me to <https://en.wikipedia.org/wiki/Main_Page>. Works as it should.
I just saw your edit, so this post is only for people like me who should encounter a similar problem.

When on Firefox, just ensure your redirection take place **after** the dom of your redirection page is **completely loaded**. To validate this hypothesis, just replace your automatic window.location by a manual redirection (HTML input type="button"). The redirection should be ok. Then, just add a javascript setTimeout on your redirection, or use a dom selector to ensure your page is loaded (e.g. jquery : 
$('document').ready(function() { $('#my\_redirect\_form').submit(); });)