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

  • Codecourse

    Codecourse

    3 ŞUBAT 2009
  • jocc talking shit

    jocc talking

    6 NİSAN 2007
  • metallmanutza13

    metallmanutz

    13 NİSAN 2007