Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How do I put the text of another website into a javascript variable

How do I put the text of another website into a javascript variable
Thread Tools
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status: Offline
Reply With Quote
May 2, 2006, 06:26 AM
 
I want to put the text of another webpage into a variable.

I know how to put my own put the text from the current page into a variable, I just want to load the text from another remote (not hosted by me) page into it.

I really hope someone can help with this, as its a big problem I can't seem to solve.

Please help!!!
     
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
May 2, 2006, 06:08 PM
 
You tell javascript to call a script on your server (php, asp, jsp, whatever) that opens the page on the remote server and feeds the data to the script.

aka ajax.
     
Professional Poster
Join Date: Jan 2001
Location: Between Sydney and Melbourne
Status: Offline
Reply With Quote
May 3, 2006, 04:56 AM
 
Originally Posted by registered_user
You tell javascript to call a script on your server (php, asp, jsp, whatever) that opens the page on the remote server and feeds the data to the script.

aka ajax.
Is there anyway to do it with just Javascript as its code for a widget?

Could I load the content in an iFrame and pass that into a variable?

Thanks in advance!
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
May 3, 2006, 06:50 AM
 
XMLHttpRequest has a same-origin limitation, and there are good reasons for that, but an iframe-based solution sounds like it ought to work. Of course, that has problems of its own; for example, you can't easily issue an HTTP POST request from an iframe. But if that's not a problem for your case, it sounds as though it should be doable.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2