I have a requirement where I have to open a URL from html page. But, before I open the URL I cannot determine if the URL is a valid or not, so when I try to open a invalid url, the webpage throws an alert saying "Safari cannot open the page because the address is invalid.".
I understand it is designed for a reason, but is there anyway to prevent showing this alert, when the url is not a valid one.
EDIT : The url is in valid format only, but the website domain is wrong. I think, regex will not help in this case.