adsense

Tuesday, October 16, 2018

check connenction from javascript

We can use javascript to check the current connection and determine if we run in local host. Here I have included the checking of custom domain name as well,


if (window.location.hostname === "localhost" || location.hostname === "127.0.0.1" || window.location.hostname.indexOf('.local') >= 0) {
    alert("Running Locally");
}

Cheers,
Samitha

No comments:

Post a Comment