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

  • boniver

    boniver

    17 NİSAN 2006
  • Cole Rolland

    Cole Rolland

    23 Kasım 2008
  • Jorrit Jongma

    Jorrit Jongm

    17 Ocak 2008