Select area and get html

Discussion in 'JavaScript' started by ojsimon, Dec 21, 2007.

  1. #1
    Hi
    I asked people in the php forum they said that it was a javascript job, i would like to make a script in which the user selects an area of any website they enter and the script returns the html for that area. any help would be greatly appreciated.

    Thanks
     
    ojsimon, Dec 21, 2007 IP
  2. thinlight

    thinlight Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    www dot webreference dot com/js/column12/crossbrowser.html
    sorry I can't post links now.
     
    thinlight, Dec 21, 2007 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    The solution pointed by thinlight do not work. With that script you can get the "user selection" (not the html code of selection) of a page on same site, but you can't with a page from a different site.
    IMO you can not do that on client side (javascript) because browsers by default are not allowed to do cross domain scripting.
    That task could be done on your server side, there you'll need to load the external page and search for start and end of user selection (sent to your server by your script). But is not a trivial task.
     
    ajsa52, Dec 21, 2007 IP
  4. Sabbir

    Sabbir Banned

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Mozilla Firefox did it. in Firefox you can select some portion and get the code of that part only. i hope mozilla plugin creators could answer you.

    best wishes.
     
    Sabbir, Dec 29, 2007 IP
  5. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    This won't show the source.
     
    MMJ, Dec 29, 2007 IP