Added some code to prevent error messages when user clicks external links that are passed to loadPage.