Skip to content

Instantly share code, notes, and snippets.

@zoechi
Forked from kasperpeulen/index.html
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoechi/6e03d4589ba1af6c3df0 to your computer and use it in GitHub Desktop.
Save zoechi/6e03d4589ba1af6c3df0 to your computer and use it in GitHub Desktop.
// SO 29434359
import 'dart:html';
import 'dart:async' show Future;
main() async {
var exists = await urlExists('https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/autofocus');
print(exists);
exists = await urlExists("https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement");
print(exists);
}
Future<bool> urlExists(String url) async {
try {
await HttpRequest.getString(url);
return true;
} catch(error) {
return false;
} // examine response for errors
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment