SORU
18 Mayıs 2011, ÇARŞAMBA


nasıl geçerli sayfa javascript kullanarak url host almak için

Şu sayfada olduğum düşünülürse:

http://www.webmail.com/pages/home.aspx

Nasıl host name ("http://www.webmail.com") almak JavaScript ile yapabilir miyim?

CEVAP
18 Mayıs 2011, ÇARŞAMBA


var host = window.location.hostname;

ya da muhtemelen

var host = "http://" window.location.hostname;

ya eğer birleştirme istersen

var http = location.protocol;
var slashes = http.concat("//");
var host = slashes.concat(window.location.hostname);

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Ben Vivona

    Ben Vivona

    24 Ocak 2010
  • chrmoe

    chrmoe

    7 Kasım 2006
  • SuperPrincessjo

    SuperPrinces

    1 EKİM 2010