Is it possible to check if a user browser / OS supports this type of link using javascript?

Is it possible to check if a user OS / browser supports a given URL scheme using javascript (or something else)?

For example, mailto: is not configured on most user computers that use only webmail. Is there any way to catch attempts to click the mailto link and display a more detailed explanation than the browser error message?

+5
source share
2 answers

Is there any way to catch attempts to click on the mailto link and display a more detailed explanation than a browser error message?

, , mailto: links. mailto, href. "mailto:", , .

var maillinks = document.getElementsByTagName("a");
var (var i = 0; i < maillinks.length; i++) {
  var currentlink = maillinks[i];
  if (currentlink.href.substring(0,7) === "mailto:") {
    alert("Sorry. These aren't allowed.");
    return false;
  }
}

, , - , , .

+1

- .

mailto: - no.

, , , , mailto:. mailto:, - "" ( ).

+2

All Articles