0

I send email as https://www.callme.com/iamavailable, now the user clicks the url from Gmail or Outlook or Mac Mail, then it opens in Google Chrome (BUG) fine but without adding https:// (Even though the original url was with https://, Google Chrome BUG)

As a result all the function of the application, stop working even though i have following .htaccess

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So, can Javascript on land read if its HTTPS or not? if not HTTPS, windows.location.href with HTTPS how?

EDIT:

function on_load() {
  var proto = window.location.protocol;
  console.log(window.location.protocol);
  if(proto=='http:') {
    window.location.href = 'https://talk.site.com/directory';
    //alert("You have http://, please open the page with https://");
    return false;
  }
}
weston
  • 54,145
  • 21
  • 145
  • 203
  • why is this tagged with `javascript` and `google-chrome`? – Jaromanda X Nov 29 '16 at 08:43
  • Its Javascript and Google chrome related. Because .htaccess does not work, i need to resolve it via Javascript –  Nov 29 '16 at 08:43
  • Then why don't you fix the .htaccess configuration? http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www – str Nov 29 '16 at 08:46
  • .htaccess is not working at all, i have tried 3 different way with .htaccess but always from email when it comes to Google chrome it lose the https:// and landing on http:// –  Nov 29 '16 at 08:55
  • http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www - I tried all of them but none of them working. always even the https:// was in the email originally, but on click it land as http:// –  Nov 29 '16 at 08:56
  • Please see EDIT. even with Javascript manually i am adding https:// again Google chrome is opening the page without https:// ???? why? –  Nov 29 '16 at 09:05
  • how is `function on_load()` being called? having a function is one thing, but it needs to be executed somehow – Jaromanda X Nov 29 '16 at 10:59
  • that is called via body: `` , it do get executed, but starts infinite load redirect, load redirect, load redirect... loop. –  Nov 29 '16 at 15:07

0 Answers0