/ Published in: JavaScript

Find top level domain in current address (JavaScript)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
el = document.createElement('DIV'); el.id="info"; document.body.appendChild(el); var re=/\.([^\.]+?)$/; domain = re.exec(location.hostname); el.innerHTML= domain[1];
Comments
