jeudi 20 décembre 2018

Change body by if else statement - url

If url is subdomain http://one.example.com then show body one, if http://two.example.com than show body two.

Each body has background image

<style>
body {
background: url(http://example.info/backgroundone.PNG); 
background-repeat: no-repeat;
background-size:cover;
}
</style>

and a link associated:

<body>
<a id="link2" href="https://click.com" target="_top"></a>
</body>

I have tried a few codes including

document.getElementById("body")

Class of ID Change based on URL - URL Based Image Swap - Creating Conditional Statement Based On Page URL ETC

And tried to manupilate this to get the full size background and link to display according to subdomain but I can't find a way to include all my needs (ie subdomain, link click, body, if else statement etc

Aucun commentaire:

Enregistrer un commentaire