Using JavaScript to Detect Whether the Url Exists Before Display in Iframe

Javascript: How can I check to see if url to fire exists before firing it?

To test an url you must access it. So, without an external service, you can't test them beforehand.

W3C provides a link checker: https://validator.w3.org/checklink
"The program can be used either as a command line tool or as a CGI script."
Maybe you can use it to test an url and, after, create or not your button.

I don't know if there is a limit for this service, so check the documentation!
http://search.cpan.org/dist/W3C-LinkChecker/bin/checklink.pod

Detect if the iframe content has loaded successfully

Nowadays the browsers have a series of security limitations that keep you away from the content of an iframe (if it isn´t of your domain).

If you really need that functionality, you have to build a server page that have to work as a proxy, that receive the url as a parameter, test if it is a valid url, and does the redirect or display the error page.



Related Topics



Leave a reply



Submit