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

  • Megan Parken

    Megan Parken

    19 Temmuz 2009
  • Phymec

    Phymec

    18 Temmuz 2009
  • RocketJump

    RocketJump

    22 ŞUBAT 2006