JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 9th, 2006, 09:59 PM
AlexSCG AlexSCG is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 3 AlexSCG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 31 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old May 10th, 2006, 12:10 AM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13
The only way to get around that is by using a server-side language to make a copy of the page on your domain.

Reply With Quote
  #3  
Old May 10th, 2006, 12:39 AM
AlexSCG AlexSCG is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 3 AlexSCG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 31 sec
Reputation Power: 0
alright

I know ASP, how do I go about doing that? Any ideas or links would help

Reply With Quote
  #4  
Old May 10th, 2006, 12:45 AM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13
I don't know ASP. You would need to ask in the ASP forum.

Reply With Quote
  #5  
Old May 11th, 2006, 10:36 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 12
Send a message via Yahoo to ravs
hey buddy go for xmlhttprequest() it will wige you full source of the page.
iframe dose this kind of problem some times.

Reply With Quote
  #6  
Old May 11th, 2006, 10:47 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13
XMLHttpRequest() is bound by the domain restrictions in some browsers as well.

Reply With Quote
  #7  
Old May 16th, 2006, 10:01 AM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 12
Send a message via Yahoo to ravs
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Getting and Parsing a page source


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap