Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » JavaScript

EXTERNAL WEBSITE CONTENT

 
Jump to:  
 
preet
PostPosted: Fri Sep 05, 2008 8:05 pm    Post subject: EXTERNAL WEBSITE CONTENT
       
This page achieves the external website content using inline frames
LINK

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

if so how



--------------------------
LINK
LINK


*** Sent via Developersdex LINK ***
 

 
totalstranger
PostPosted: Mon Sep 08, 2008 3:36 am    Post subject: 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
LINK

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;
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

hurtownia słodyczy Diety kredyty gry dla dziewczyn Yahoo