|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Getting and Parsing a page source
Hello,
I have looked through this site for similar subjects but couldnt find what I was looking for, forgive if I missed. Here is what I would like to accomplish: I load a webpage, in another domain into an iframe and I would like to get to the source code of it, or at least to the <body> tag. I dont want to edit it or pass anything to it, I just want to get the source, parse through it and depending on what I find do other stuff unrelated to that page. Here is what I have: <script language="javascript"> function GetSource(){ var myhtml = document.frames('gameframe').document.body.innerHT ML; alert(myhtml); } </script> Now, this works, but I get "Access Denied" error message. I think because my parent page and the page I am looking at in the iframe are on different domains it is restricting access. I would like to know if it is possible to get around, maybe using XMLHTTPRequest or something else... Thank you in advance |
|
#2
|
|||
|
|||
|
The only way to get around that is by using a server-side language to make a copy of the page on your domain.
|
|
#3
|
|||
|
|||
|
alright
I know ASP, how do I go about doing that? Any ideas or links would help
|
|
#5
|
|||
|
|||
|
hey buddy go for xmlhttprequest() it will wige you full source of the page.
iframe dose this kind of problem some times. |
|
#6
|
|||
|
|||
|
XMLHttpRequest() is bound by the domain restrictions in some browsers as well.
|
|
#7
|
|||
|
|||
|
yea i agree with u friend
firefox is one of them. but on the most of the browsers you can use xmlhttp . but wait for a sec yesterday i was searching same thing to post huge data , because by using ajax it is easy to fetch data to client side but it is difficul;t to save , if u have huge data. so i tried my hand on iframe. but i am not able to navigate it so i tried on google and what i found it this var oIfrm=document.getelementById("someIframe").contentWindow http://codinginparadise.org/weblog/2005/08/ajax-tutorial-saving-session-across.html go for this also it will help you |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Getting and Parsing a page source |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|