View Full Version : How do I add content from another page.

07-20-2011, 05:44 PM
I want to create several pages (they can be text or html) with basic informatons for css formatting.
<div class="appname"
name: this app
<div class="appdetails">
Version: 1.0
Date: 1/1/2011
Description: this is an app

I want to be able to save several of these and load them into a web page where they are formatted and displayed.

This needs to be a client side solution so that I can be able to access this offline.

Any suggestions?

Edit: so far I have tried this but I am not sure about it.
<object type="text/html" data="app1.html">

07-20-2011, 08:38 PM
How can one web page retrieve html code from another source (text or html file) and parse it on the client's side.

07-20-2011, 09:15 PM
You can start a so called Ajax request if the source file is on the same domain, sub domain and is reachable via the same protocol as the current page

If you search for Ajax you will find tons of examples

07-20-2011, 09:53 PM
Thank you. First search result had the answer.

Quick question: In the following example is page formatted then retrieved or does the calling page apply the CSS.

<a href="javascript:ajaxpage('ajaxfiles/external3.htm', 'rightcolumn');">Page</a>

07-20-2011, 10:11 PM
The latter

It is always the CSS from the calling page that is being applied to retrieved content.

07-22-2011, 05:16 PM
I was searching for a new question and this was the first result. It builds on my original question so I will post here.

How do I append (a div) from one page into the current page (div)

So far I have two solutions for retrieving the content

//jquery load one element
$('#rightcolumn').load('techtools/external.htm .app_specs');
//ajax load full page
ajaxpage('techtools/external.htm', 'rightcolumn');

Now I don't want each call to the function to replace the current content but append to it.