Thanks for the feedback everyone. I’m definitely going to add in some more features with extensions but when I saw @Futuredev’s post yesterday I wanted to add this in ASAP. This release will add the ability to check for a domain name from a large list of domain names. The really nice thing here is that it “fails” gracefully. If the users accidentally types the wrong thing it will search for the term on Google rather than showing some sort of “Can’t resolve host name” error message.
If you’re following along at home, here are the changes from version 3. The first thing to do is create two new variables. The first,
listOfTLDs is to store the all of the top level domains, or domain names to me and you. The second
isWebsite is basically a switch that we can set as true or false depending on whether or not the user has entered a valid domain name.
Next thing we want to do is add all of those TLDs to our list:
You can find a link to all of them in the original post:
(Yes, I did try adding them as a .csv file but when it didn’t work first time I opted for the old reliable copy-and-paste approach)
Most importantly, we need to check if the user has typed a valid domain name into the browser. What I’ve opted for here is splitting the domain name at each
. and checking if the last item exactly matches any of the items in your
The notifier at the end was simply a way of seeing if it had worked while I was testing. This block has been disabled in the .aia file I shared.
btnGo.Click event is modified to handle what we should do if the user has typed in a valid domain name.
One thing that I forget to mention is that the way this is coded it will no longer accept GET requests or copy and pasting long URLs (this might be a deal breaker for some of you!) I’ll find a way to restore this functionality in a future update, but if you have to have this in your browser you will need to find a better way to match the domain names.
That’s it for this update. Hope you like it and keep the suggestions coming!