List unsecure resources
Posted by: JohnHell
Date: May 02, 2014 02:27AM

You know that from time to time people come to the General subforum asking what the red url bar means in a secured site.

I had in mind a macro to show what unsecure elements were causing it and I adapted the ones from list images and and links to this one.

I use the old definition macro (used back in K-meleon 0.82), so I post here as a reference to be adapted to the current versions (the funcionality is the same but differs in some "standard"/"non-standard" references).

Note that in some sites the macro won't display things. That seems beyond our hand when unsecure resources are called with AJAX and in real-time. Indeed in YouTube aren't shown sad smiley

$JSfunc="with(document)var cnt=0,nurf='"._("No unsecure resources found.")."',tit='"._("Unsecure resources: %s")."'.replace(/%s/,(title)?title:unescape(URL)),txt='';";

$JSdoit="var httpu; var elements; var elementsL; if(getElementsByTagName('body')[0]){txt+='\\n<fieldset><legend>'+((title)?title:unescape(URL)).link(URL)+'</legend><ol>'; cnt+=document.getElementsByTagName('*').length;elements = document.getElementsByTagName('*'); elementsL = elements.length; if(elementsL){for(var j=0;j<elementsL;j++){if(elements[j].src){httpu = elements[j].src.indexOf('ttp://'); if(httpu !=-1){txt+='<li style=\"margin-top: 5px; padding: 10px; border-top: 1px solid green; border-left: 1px dotted orange\"><a target=\"blank\" href=\"'+(elements[j].src)+'\">'+(elements[j].src)+'</a></li>\\n';}}}}}else{txt+='<p>'+nurf+'</p>';txt+='</ol></fieldset>';}";

$JSlast="if(cnt){var imgWin=open('','kmIMG'+Math.floor(Math.random()*1000),'');with(imgWin.document){open();write('<html><head><title>'+tit+'</title><style type=\"text/css\">\\n".gsub("\n","\\n",readfile($macroResLoc."macros.css"))."\\n</style></head>\\n<body class=\"km_lstImages\">'+txt+'\\n</body></html>');close()}}else alert(nif)";


Oh, I forgot, it is useful also in non-SSL sites when you want to know resources paths, as for example scripts files (.js, or .css) when they have ABSOLUTE PATHS, NOT RELATIVE, relative paths aren't called by specify the protocol used.

Edited 3 time(s). Last edit at 05/02/2014 02:30AM by JohnHell.

K-Meleon forum is powered by Phorum.