0

I'm trying to manipulate the content of an HTML page.

Scenario 1:

When I change the domain name to end in .com, the URL in my content automatically change to www.example.com. This is the sample dotCOM

Scenario 2:

Same thing to domain name ending in .org, the URL in my content automatically change to www.example.org. This is the sample dotORG

My expected output

If I type the domain name ending in .org on the URL, I want the content www.example.com to be static .com. Like this Output.

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8" />
    <title>Sample Title</title>
    <link href="/css/design.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <h3>Lorem ipsum</h3>
    <ol>
        <li>www.babyshark.com is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's 
        standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type 
        specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, 
        remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets 
        containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus 
        PageMaker including versions of Lorem Ipsum.</li>
    </ol>
</body>
</html>
Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
Damme
  • 1
  • 3

1 Answers1

0

below program should be help full to you

    function domain_after_dot(){
    var domainname = document.location.host.toString();
    var after_dot=domainname.slice(domainname.lastIndexOf("."),domainname.length);
     return after_dot;
    }

use document.getElementByid("id").innerHTML = domail_after_dot() which return specified domain of your domain name here id must be replace which you attributes id

manan5439
  • 898
  • 9
  • 24
  • I am just thinking, is it possible fixing the problem without Javascript? – Damme Jun 13 '18 at 08:01
  • You can put statically .com or .org as per domain routing – manan5439 Jun 13 '18 at 08:12
  • I hosted the website locally to IIS and it seems to not having any problem, but whenever the website is committed on the live server the problem occurs. – Damme Jun 14 '18 at 02:37