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

  • Adam Khoury

    Adam Khoury

    23 Ocak 2008
  • Bennythecoder

    Bennythecode

    25 Mart 2008
  • TantalizingTrance

    TantalizingT

    15 ŞUBAT 2009