Run and load javascript within href?
Posted: Sun Mar 29, 2009 1:14 am
Hi, I would like to do this trick and was not sure if possible. Let say website http://www.aaa.com is someone else site. If I post a link on there, I would like when people click the link, instead of going to the url in href, it will popup a IFRAME or DIV on top of current page. How to do something like that? I would imagine using something like "javascript:function()" in the href but that must load the .js file somewhere, right? There was this company called Polyvore using this technique below in the href:
However, that only works if the link is in the bookmark of browser. It loads clipper.js. Is there a way to do this without making a link a bookmark first on client side?
Thanks.
Code: Select all
javascript:(function(){function t(d){var w=window;if(w.PolyvoreClipper){w.PolyvoreClipper.run();}else{var s=d.createElement("script");w._polyvoreMode="prod";s.src="http://polyvore.cachefly.net/rsrc/clipper.js?"+Math.floor((new Date()).getTime()/86400000);d.body.appendChild(s);}}try{t(document);}catch(e){}for(var i=0;i<frames.length;++i){var f=frames[i];try{if(f.frameElement.tagName=="IFRAME"){continue;}if(f.innerWidth<400||f.innerHeight<400){continue;}t(f.document);}catch(g){}}})();Thanks.