Hi I'm trying to create a bookmark-let that will open a webpage find a link to a download on that page and then close the webpage. Unless there's a better way to do it I'm opening the page, calling ready(which I think is the part that's not workint) and then searching for the download link. The code for importing jQuery is taken from: http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/
javascript:(function() {
var v = "1.3.2";
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
done = true;
initMyBookmarklet();
}
};
document.getElementsByTagName("head")[0].appendChild(script);
}
else {
initMyBookmarklet();
}
function initMyBookmarklet() {
var ytm = window.open('http://example.com');
jQuery(document).ready(function() {
var div = ytm.document.getElementById("dl_link");
var links = ytm.document.getElementsByTagName('a');
var dl = links[1];
window.open(dl);});
ytm.close();
}
})();
Thanks In advance!