Using the Google Chrome API tab.url value what is the best method to get just the domain from the entire value?
In JavaScript I would use 'window.location.protocol' & 'window.location.hostname'...for example something like this:
var domain = window.location.protocol + "//" + window.location.hostname;
But that gets the extension domain and not the tab so cannot use that method. So with a function similar to the one below...how would I strip just the domain from the tab.url value? Thanks in advance!
function show_alert()
{
chrome.tabs.getSelected(null, function(tab) {
var currentURL = tab.url;
alert(currentURL);
});
}