B
B
bpGusar2018-03-05 18:26:52
JavaScript
bpGusar, 2018-03-05 18:26:52

How to track what domain name you are on and issue an alert to JS?

How to track what domain name you are on and issue an alert on JS or jQuery ?

For example, on the test.ru domain issue alert('1') and here subdomen.test.ru issue alert('2')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima, 2018-03-05
Dolgoter @DDolgy

var a=document.domain;
        if(a=="test.ru"){

alert(1)
}elseif(a=="poddomen.test.ru"){
alert(2)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question