SORU
18 Ocak 2011, Salı


HTTP tespit veya JavaScript HTTPS force HTTPS sonra

HTTP veya HTTPS tespit ve JavaScript ile HTTPS kullanımını zorlaması için herhangi bir yolu var mı?

HTTP tespit için bazı kodlar var ama o https: kullanmak için zorlayamam HTTPS .

Kullanıyorumpencere.konum:protokolsite 3 ** Her neyse ayarlamak için özellik umarım yeni çiğnenmiş bir https URL tarayıcı yüklü yeniden yüklemek için sayfayı yenileyin.

if (window.location.protocol != "https:") {
   window.location.protocol = "https:";
   window.location.reload();
}

CEVAP
18 Ocak 2011, Salı


Bu deneyin

if (window.location.protocol != "https:")
    window.location.href = "https:"   window.location.href.substring(window.location.protocol.length);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Avast

    Avast

    27 NİSAN 2006
  • HDstarcraft

    HDstarcraft

    12 Mayıs 2009
  • ipsy

    ipsy

    1 EKİM 2012