Bookmarklet for Document Info (Page Info)



  • First of all, I already lost track the origin of this bookmarklet. So, credit goes to somebody who make this. I grab it around my old Opera era. Opera doesn't have Page Info back then.
    I don't maintain this bookmarklet.

    Miss Firefox Page Info?
    This bookmarklet produce a tab with a bit of info of the page.

    • Last modified.
    • Cookies.
    • Links.
    • Images.

    Okay, not as powerful or informative as Firefox Page Info.
    Save this javascript as bookmark.

    javascript:(function(){win=window.open('','Z6','width=400,height=400,scrollbars,resizable,menubar');var%20frtd=location.hash?'<h4>Hash</h4>'+location.hash:'';var%20ref=document.referrer?'<h4>Referrer</h4>'+document.referrer:'';var%20cook=document.cookie?'<h4>Cookie</h4>'+document.cookie:'';var%20hmm='<h4>Links</h4>';var%20hmmt='<h4>Images</h4><center>';for(var%20i=document.links.length-1,%20ty;ty=document.links[i];i--){hmm+=!ty.href.match(/^(javascript:|data:)/)?'<br/><a%20href=%22'+ty.href+'%22>'+ty.href+'</a>,':'';}if(document.images.length){for(var%20i=document.images.length-1,%20ty;ty=document.images[i];i--){hmmt+='<br/><a%20href=%22'+ty.src+'%22><img%20src=%22'+ty.src+'%22></a>,'}}else{hmmt=''};var%20to=hmm+'{}'+hmmt;for%20(var%20a%20=%20to.split(','),%20i%20=%200,%20o%20=%20{},%20s2%20=%20'';%20i%20<%20a.length;%20i++){if%20(i%20>%200)s2%20+=%20'%20';if%20(!o[a[i]]){s2%20+=%20a[i];o[a[i]]%20=true;}}hmm=s2.split('{}')[0];hmmt=s2.split('{}')[1]+'</center>';var%20tyu='<h4>Frame%20URL\'s</h4>';if(window.frames.length){for(var%20i=window.frames.length-1;ty,ty=window.frames[i];i--){try{tyu+='<a%20href=%22'+ty.location+'%22>'+ty.location+'</a>'}catch(e){opera.postError('frame%20'+i+'%20could%20not%20be%20captured')}}}else{tyu=''}with(win.document){write('<h4>URL</h4>'+URL+'<h4>Hostname</h4>'+location.hostname+'<h4>Document%20last%20modified</h4>'+lastModified+'%20'+frtd+ref+cook+hmm+hmmt+tyu)}%20})()
    

    P.S:
    If you happen to know who make this please let me know.



  • This is cool, even if something doesn't work as it should, for example it gets always "about:blank" as URL, btw it's handy and something like this should be absolutely fantastic if implemented natively in the context RMB menu.



  • @iAN-CooG
    Yeah, I hope Page Info implement natively.

    That link list probably the most useful for me.

    Some old bookmarklets just reborn as extensions or userscripts (the closest sister).
    Unfortunately bookmarklet is dying. It the most less resources.
    Probably only people who ever use Netscape (read: old geezer :laughing: ) ever heard about it.



  • @dLeon How do you make this bookmarklet work in Vivaldi? I've got a couple of bookmarklets to open new tabs (or close the current one) and none of them (including this one) actually work in Vivaldi... 😐



  • @pafflick
    I just make it as normal bookmark address. And click it on a page.

    This the result of this thread page;
    0_1487958044075_doc_info.png



  • Just add the javascript as address of a new bookmark, assign a nick (I use pi for page info), title Page info, and just select it on a page or type pi in address bar. It's true that it's not working everywhere, sometimes I get a blank page only.



  • OK, this is how it works (or doesn't work) here:

    Paste into address bar ➡ Press [ENTER] = Doesn't work
    Focus address bar ➡ Paste & Go or [CTRL] + [SHIFT] + [ENTER] = Works
    Open through bookmarks panel = Doesn't work
    Open through bookmarks bar = Doesn't work

    I have tried all of these - except for the "Paste & Go" method and thus I've assumed that it doesn't work at all. But still, that's quite inconvenient. I have a couple of bookmarklets that I rarely use and most of them didn't work for me... 🤔



  • @pafflick
    That's weird.
    I have no idea what happen. :confused:
    Even refreshing the page before using it also doesn't work?



  • @dLeon OK, I've made some digging and it seems to be a problem on my side. Almost all of the bookmarklets for some reason had broken syntax. Frankly, I haven't used any of them since importing my bookmarks to Vivaldi and I haven't noticed this before.

    I was able to fix almost all of them, except for the one used for closing tabs - it sometimes produces blank tabs and sometimes has no effect at all, though it has to be a Chromium thing. But I don't even use that one, so I don't really care about it. 😃

    For some reason, though, when I triple-click on the code that you've posted above, I get some extra characters at the end of the code and that's why it didn't work for me before. Now, after removing those extra characters it works fine. If you'd include the semicolon ; at the end of your code, it'd probably never happen... 😉



  • @pafflick
    Agh... you're right. That's the right way.
    Copy/Paste from my bookmark. :bow_tone3:

    Nevertheless, I try triple click it & try to create new bookmarklet my self. It doesn't add extra anything to me.
    In text editor however, it add extra Carriage Return or Line Feed.
    The new bookmarklet also just work.

    Maybe this Unix/Dos/Mac utf-8 format issue? :confused:



  • @dLeon Well, I'm not sure - what matters the most is that it finally works. 😃


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.