Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old September 5th, 2008, 11:05 PM
preet
Guest
 
Posts: n/a
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 ***
  #2  
Old September 8th, 2008, 06:45 AM
totalstranger
Guest
 
Posts: n/a
Default Re: EXTERNAL WEBSITE CONTENT

On or about 9/5/2008 18:05, it came to pass that preet wrote:
Quote:
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;




 

Bookmarks

Thread Tools

Posting 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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles