469,291 Members | 1,777 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,291 developers. It's quick & easy.

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 ***
Sep 5 '08 #1
1 1370
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;


Sep 8 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bruce Arp | last post: by
6 posts views Thread by Alex Nitulescu | last post: by
2 posts views Thread by MotorcycleIke | last post: by
3 posts views Thread by RICHARD BROMBERG | last post: by
reply views Thread by Andrea Anastasescu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.