6
I want to exhibit a iframe
with an external page and then show in a textarea
all JS code requested by iframe
in question.
I have two problems: the first is how to know all the requisitions that the iframe
made, and then take each and show the code.
I tried to make getScript
and Ajax in Javascript URL to put in textarea
, but I have a problem with cross-Domain, and when I can do the request
, no field comes textResponse
so that I can pick up the text and display.
How do I do that? It’s possible?
I can only use language frontend, can be any library, jQuery or even pure Javascript.
If you worked with PHP, I would teach you a way to get all JS by domdocument ;)
– Wallace Maxters
In the browser you will always hit the cross origin problem. The only way I know how to make an external request without this problem is within a browser extension. Both Chrome and Firefox allow you to perform external requests issues. In the case of Chrome you can even capture all requests made by the page with the Extensions API.
– Guilherme Nagatomo
What code have you made so far?
– PauloHDSousa
I ended up solving this problem with a yahoo service called YQL
– Gabrielle
Gabriele can put an answer with the solution you found and with an example?
– Sergio
I ended up solving this problem with a yahoo service called YQL
– Gabrielle
I wanted to say an answer down here, in the field of answers with an example. Thank you!
– Sergio
If it is the same domain you can get through Document.querySelector('iframe').contentWindow.window.Document if it is not as @Guilhermenagatomo said.
– LeonanCarvalho
@Grabrielle, explain it better? Do you want to capture javascript inside the iframe or outside the iframe? Or you just want to capture the html code of the iframe in the textarea? Because iframe does not have javascript code, necessarily.
– Ivan Ferrer