1

I have a page (page1.html) and I want to send an ajax to page2.html (http://m-kermani.github.io/getapp.html) and page2.html has an iframe that made by javascript

I made it by javaScript because I need to send a parameter to the page3

In page1.html I have:

$.get('https://m-kermani.github.io/getapp.html', function (data) {
    alert(data);
});

and I just need the iframe content but beacuse it made by JavaScript I can't get it and that did not created! (This is the way JavaScirpt is)

I need to send ajax request and get the iframe content because I need an https domain for some reasons that GitHub.io is!

No I need to know is there anyway I can get the content of the iframe from GitHub page?

Is there any other way I can direly just have GitHub page and give the parameter to it and can get the content of the page3 (not using server side language)?

And suggestion about what can I do?

Mohammad Kermani
  • 5,188
  • 7
  • 37
  • 61

2 Answers2

1

Sounds like you're trying to circumcent the same-origin policy. Unless the API you're trying to access specifically supports a way to do it (CORS, JSONP, etc), you can't do it. You should read the documentation of the API you're trying to access to see if they support accessing it from the client side.

Community
  • 1
  • 1
Matti Virkkunen
  • 63,558
  • 9
  • 127
  • 159
1

An Ajax request is just a request for a resource. It just gets whatever the server is going to send. It doesn't automatically render the HTML and fetch dependant resources.

If you want the content of a frame, then you have to request the URL for the frame instead of the URL for the page with the <iframe> tag in it.

(The Same Origin Policy will still apply).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Let me tell you what is the problem; I am developing a chrome extension and it asks me to send request to https but my own domain is not https and I was looking for a way to do it (github is https) – Mohammad Kermani Apr 28 '16 at 10:45