Skip to content

Instantly share code, notes, and snippets.

Created November 1, 2008 02:12
Show Gist options
  • Save anonymous/21463 to your computer and use it in GitHub Desktop.
Save anonymous/21463 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "get-page-title",
preview: function(previewBlock) {
Utils.parseRemoteDocument(
"http://www.google.com/", // URL
null, // post data
function(doc) { // success callback
var title = jQuery("head > title", doc).text();
previewBlock.innerHTML = "Google's page title is: <b>" + title + "</b>";
},
function() { // error callback
previewBlock.innerHTML = "Error!";
}
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment