EXTERNAL WEBSITE CONTENT

This is a discussion on EXTERNAL WEBSITE CONTENT within the Javascript forums in Programming Languages category; This page achieves the external website content using inline frames http://www.anchorfx.com/forex/daily-...ction-bias.asp can the same thing be done in javascript without using inline frames if so how -------------------------- http://www.eecpindia.com http://www.anchorfx.com *** Sent via Developersdex http://www.developersdex.com ***...

Go Back   Application Development Forum > Programming Languages > Javascript

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-05-2008, 06:05 PM
preet
Guest
 
Default EXTERNAL WEBSITE CONTENT

This page achieves the external website content using inline frames
http://www.anchorfx.com/forex/daily-...ction-bias.asp

can the same thing be done in javascript without using inline frames

if so how



--------------------------
http://www.eecpindia.com
http://www.anchorfx.com


*** Sent via Developersdex http://www.developersdex.com ***
Reply With Quote
  #2  
Old 09-08-2008, 01:36 AM
totalstranger
Guest
 
Default Re: EXTERNAL WEBSITE CONTENT

On or about 9/5/2008 18:05, it came to pass that preet wrote:
> This page achieves the external website content using inline frames
> http://www.anchorfx.com/forex/daily-...ction-bias.asp
>
> can the same thing be done in javascript without using inline frames
>
> if so how
>


Yes but you need create the Javascript on a server. Use PHP (or your
language of choice) to generate Javascript. This is perfectly legal and
avoids all the IFRAME issues for a foreign site.

On the page where you want content:
<div id='ContentDiv'>
<noscript><b>*****WARNING JAVASCRIPT IS DISABLED, IT MUST BE ENABLED TO
PROPERLY VIEW THIS PAGE*****</b></noscript>
....Loading data from Example.Com...
</div>
<script type="text/javascript"
src="http://www.example.com/Script.php"></script>

Script.php runs on your server, generates data or reads another web
site, then formats the result into a Javascript command that updates the
innerHTML of ContentDiv as follows:
document.getElementById('ContentDiv').innerHTML = 'Whatever you want';

you may bump into issues with some characters that cause the generated
Javascipt to fail. Here's how I fixed it (using PHP on server) assuming
the result is in $buffer
$buffer = str_replace("\\", "\\\\", $buffer);
$buffer = str_replace("\r", "\\r", $buffer);
$buffer = str_replace("\n", "\\n", $buffer);
$buffer = str_replace("'", "\\'", $buffer);
$buffer = str_replace('"', '\\"', $buffer);
return $buffer;




Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:46 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.