SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there a way to read the source code of a page on a diffarent host?

    I need to read the source of a page that is NOT on the same host as my script. Is there any way I can do it with javascript?

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    'read the source' ? How so?
    (What I mean is, if you tell us your goal then it's easier to solve the problem. )

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    London, UK
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    No.

    There isn't. You have write a little program on your server side that opens a URL and grabs the code and then with some sort of AJAX or alike you can do things with it in your javascript on your local server.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,836
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Javascript only has access to the current web page, other web pages from the same domain that are in frames or windows open at the same time, cookies set by the current domain, and the server for the current domain. For anything else you need to pass the request to the server and have the server pass the request to the other domain and pass back the result.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your help guys


Bookmarks

Posting Permissions

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