Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    View-Source Bookmarklet

    I didn't know about this until a few hours ago. I thought it was cool, so I thought I'd share it.

    I got the code from brothercake, although I did add a few tweaks to it.

    Just save this as a bookmark, and you can view the source of any site with just a click (even "protected" sites )

    Code:
    javascript:var newWin=window.open(); newWin.document.body.innerHTML=('<b style="font-family:Verdana; font-size:9pt;">Source of '+location.href+'</b><br><br><br><xmp style="font-family:Verdana; font-size:8pt; color:#000080;"><html>'+document.getElementsByTagName('html')[0].innerHTML+'</html></xmp>'); newWin.select(); newWin.focus(); void(0);
    Just remember to remove the space in "javascript:"

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    newWin.select() causes a javascript error.

  • #3
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts

    Lightbulb

    javascript:void(location.href="view-source:" + location.href)

    Works in IE6 and Mozilla 1.4b nightly.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    A 4D universe
    Posts
    1,337
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So does this thing work?
    http://www.mudsplat.com - Web design, print, and marketing solutions.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Beyond Lament
    Posts
    424
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does not seem to work for me, just opens another window "about:blank"...

    IE6/Win2k
    Quíet Storm Designs ~ Art is not what you see, but what you make others see.
    · the Storms· || ·Ultraviolent Winter· || ·Was Einstein Wrong?· || ·It´s About Time!·

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As promised it worked daily : Win2k ie6
    and nightly : WinXP Pro ie6

    for me

  • #7
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It works for me on Moz 1.4a and IE6 under Windows XP.

    Internet Explorer's bookmarks suck though. You need to create a new bookmark as something else, then edit it with this information.

    I've had no problems, and as I said, I didn't write it. I just slightly modified the code I got from someone else. I just thought this was useful.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #8
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    Um, which version are you guys testing and giving "Did it work" comments for?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried yours because I am lazy and it was shorter. It is a very useful script.

  • #10
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: View-Source Bookmarklet

    This one even allows you to edit the HTML of the page "on the fly":

    Code:
    javascript:a=window.open('','','width=500,height=500,resizable=yes');a.document.write('<TEXTAREA cols=70 name=Sor rows=20 style="WIDTH: 100%" wrap=off></TEXTAREA><INPUT value=Submit type=button onClick="top.window.opener.document.write(Sor.value);top.window.opener.document.close()">');a.Sor.value=document.getElementsByTagName('html')[0].innerHTML;void(0);
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #11
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    How can I make
    Code:
    java script:var newWin=window.open(); newWin.document.body.innerHTML=('<b style="font-family:Verdana; font-size:9pt;">Source of '+location.href+'</b><br><br><br><xmp style="font-family:Verdana; font-size:8pt; color:#000080;"><html>'+document.getElementsByTagName('html')[0].innerHTML+'</html></xmp>'); newWin.select(); newWin.focus(); void(0);
    a bookmark?

    Do I save this line in a notepad document and save THAT as a bookmark?
    I don't understand.
    Shawn

  • #12
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Borgtex...



    Added 'wrap=virtual', then spent 40 minutes sprinkling the front page of the New York Times website with obscenities and absurdities. Great fun. Tomorrow: msdn.

    cbp

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    to make it into a bookmark, you get it all in one line then go Bookmarks > Add Bookmark (or Favourites> Add to favourites) then in the page address paste the line in that box.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #14
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    ok thanks


    edit:
    hmm, I don't get it, when I press Add to favorites, it adds THIS page, if I put that line in the box it will only change the NAME of the favorite... I tried putting that line in the adress bar and pressing enter, that opened a new window with nothing in it, but it didn't change the page I'm in now (This page)
    help?
    /edit
    Last edited by shlagish; 05-18-2003 at 06:02 PM.
    Shawn


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •