S
S
siliconbaba2014-12-03 20:52:33
JavaScript
siliconbaba, 2014-12-03 20:52:33

How to hide a site element on a specific domain?

There is a site with 2 domains: .com and .ru. It is required to hide the site element when opening it via .com (the element should be displayed on .ru). That is, it would be nice to have a script that reacts to which domain it starts from, and hides the element as appropriate. Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Ruslan, 2014-12-03
@Razbezhkin

Please specify whether you need the script to work on the client side or on the server side. if on the server, then what platform do you have there?

S
siliconbaba, 2014-12-03
@siliconbaba

Ruslan , I think that it will be better on the client side.

M
mixlo, 2014-12-03
@mixlo

var uri = window.location.href;
var domain = new String(uri.substr(uri.indexOf(":")+3).split("/",1));
var zone = domain.substr(domain.indexOf(".")+1).toLowerCase();

if (zone == "ru")
   alert("RU-домен");
else if (zone == "com")
   alert("COM-домен");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question