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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Loading HTML from another page

    I know I can use PhP and use cURL to grab the contents of another webpage, but I want to be able to do it non-server side

    Is there a way to send a request to say "http://www.website.com/test.php?id=1", then grab the contents and put it on the current web page without using cURL and being able to do it non-server side?



    I can further explain if needed, but this was the best I could figure.


    Thanks in advance,

    Cody

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,243
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    Quote Originally Posted by Cody_ View Post
    I know I can use PhP and use cURL to grab the contents of another webpage, but I want to be able to do it non-server side

    Is there a way to send a request to say "http://www.website.com/test.php?id=1", then grab the contents and put it on the current web page without using cURL and being able to do it non-server side?



    I can further explain if needed, but this was the best I could figure.


    Thanks in advance,

    Cody
    In a word, no. JavaScript automatically prevents scripts on one server from accessing properties of documents on a different server. The Same Origin Policy states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.

    Quizmaster: How many players are there in a septet?
    Contestant: Well, September is the ninth month so it might be nine. I'll go for five.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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