Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Website Translator provokes mixed content error
    primarykey
    data
    text
    <p>Since yesterday, I got mixed content errors on my website in both Chrome and IE. The error is provoked by the Google Translate script included in the header:</p> <pre><code>&lt;script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"&gt;&lt;/script&gt; </code></pre> <p>I downloaded the file element.js and eventually figured out where the bug comes from:</p> <pre><code>var s = window.location.protocol == 'https' ? 'https' : 'http'; </code></pre> <p>Using (any) browser console, we can see that the expression "window.location.protocol" returns "https:" (and not "http") in all secure websites. Therefore, the script tries to load a bunch of CSS/JavaScript resources it needs, prefixing their URL with "http" instead of "https".</p> <p>Which results in the following errors (one per resource):</p> <pre><code>The page at https://mysite.com ran insecure content from http://translate.googleapis.com/[something].css </code></pre> <p>The Google Translate tool is really useful to my users so I cannot remove it. Also, I tried to download the script and run it locally but it doesn't work. I spent a lot of time on that issue, am I the only one in that situation or something changed recently in the Google Translate script?</p> <p><strong>[EDIT]</strong></p> <p>I just took a look at the Google Analytics code and found that:</p> <pre><code>ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www'); </code></pre> <p>This reinforces the idea that the Google Translate script should test for "https:" too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload