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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Screen scrape/accessing source of local browser via javascript...

    Would it be possible to pop open a local browser, and screen scrape this new browser via JavaScript? Is there a way to capture and dump into a file, the source code of a local browser instance with javascript?

    Thanks for the help!

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    yes, if the pop-ups page is on the same domain as the main page.

    you can look at the popup's window and contentDocument objects to get DOM handles to the page's code.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, was just doing some further research, and realized the cross-browser scripting security pretty much prevents me from doing what I want to do. So if page A on domain1.com contains javascript that opens a new window, page B, with the url set to "domain2.com/index.htm", there is no way for javascript on page A to access the source or the DOM objects on page B, correct? I am actually looking to dump the source from page B into a textarea on page A, but doesn't sound like it's possible if they are from different domains...?

    Thanks again for any insight!!

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you can run the script from the second site, and export the data to the first.

    this requires a bookmarklet that runs from the second page.
    you can pass 2kb of data in the url, or with some browsers like firefox3, you can send a message to another window from a different domain of unlimited length.

    there are also settings you can change to circumvent the domain restrictions.


    is this something that just has to work for you alone, or many visitors to your site?
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #5
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right now, if I could get it working for just myself, that would be great. In the above scenario, domain1 is under my control (I am designing and uploading the pages), domain2 is out of my control (i.e. a 3rd party site I have no access to other than trying to scrape whatever is served to a browser).

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you might look into greasemonkey, it allows cross-domain requests...
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

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