I have an anchor tag in my application which points to an external website.
say; "<http://www.google.com'>>General Search<>" . User on clicking this link will be taken to google home page. I have links of these types in several pages of my application. All points to external websites. User is the one who actually inputs the href and we dynamically creates the link with that , And we are not providing any validation to check whether the url is a valid one.
Say ; if the user enters "somebadtextnotavalidurl" application will generate a link which looks like "<>somebadtextnotavalidurl<>" , Which on clicking will gives a 404 error.
My requirement is that i need to handle this link click in my page using javascript; If it is a valid url a new tab should be open for the url page and display the content, Else if it is a 404 then also a new tab should be open but instead of the default 404 error page that browser displays i need my own styled and formatted page should be displayed.