I have this Code, and it's working.
var URL = new Object(); URL.pattern = /https?:\/\/([^\/]*)\//; URL.current = window.location.href; URL.getCurrent = function(){ return this.current.match(this.pattern)[1]; }; var thisDomain = URL.getCurrent(); Now what I want is to put the dot notations into the object, how do I do that? I tried this, but it's showing undefined when I call URL.getCurrent().
function URL(){ this.pattern = /https?:\/\/([^\/]*)\//; this.current = window.location.href; this.getCurrent = function(){ return this.current.match(this.pattern)[1]; }; } I hope someone can help me out.