Reproducing a web page and add own content to it.

L

LaundroMat

Hi -

I'm working on a Django powered site where one of the required
functionalities is the possibility of displaying the content of
external pages, with an extra banner at the top where specific
information is displayed. In other words, I'm looking for a way to
reproduce an existing web page and add some HTML code to it. (I can't
think of an example right now, but the idea is similar to sites that
let you see an external page and have some site-specific text above it
(often stating that the content below is not part of the site the user
comes from)).

To test this, I've been downloading an external page, adding some text
to it and re-opening it in a browser (with the help of built-in
modules such as urllib2 etc). This works of course, but the external
page's links such as <img src="hello.png">, or <a href="help.html">
are evidently no longer correct.

Apart from parsing the whole file and trying to inject the external
site's domain in links such as the above (with the added inconvenience
of having to store the external page locally), is there an easier way
of accomplishing what I want?

Thanks,

Mathieu
 
D

Diez B. Roggisch

LaundroMat said:
Hi -

I'm working on a Django powered site where one of the required
functionalities is the possibility of displaying the content of
external pages, with an extra banner at the top where specific
information is displayed. In other words, I'm looking for a way to
reproduce an existing web page and add some HTML code to it. (I can't
think of an example right now, but the idea is similar to sites that
let you see an external page and have some site-specific text above it
(often stating that the content below is not part of the site the user
comes from)).

To test this, I've been downloading an external page, adding some text
to it and re-opening it in a browser (with the help of built-in
modules such as urllib2 etc). This works of course, but the external
page's links such as <img src="hello.png">, or <a href="help.html">
are evidently no longer correct.

Apart from parsing the whole file and trying to inject the external
site's domain in links such as the above (with the added inconvenience
of having to store the external page locally), is there an easier way
of accomplishing what I want?

Using a frame?

Diez
 
L

LaundroMat

Using a frame?

Diez

Ack. I was too focused on importing the external web page and
redisplaying the information (I've just been reading up on
BeautifulSoup) instead of looking for an HTML based approach.

Thanks!
 
S

Steve Holden

LaundroMat said:
Ack. I was too focused on importing the external web page and
redisplaying the information (I've just been reading up on
BeautifulSoup) instead of looking for an HTML based approach.

Thanks!

You could also look at adding a <base> tag to your generated page's
<head> section.

regards
Steve
 
L

LaundroMat

You could also look at adding a <base> tag to your generated page's
<head> section.

regards
Steve

True, but I suppose that users would no longer see the top banner
added by me when they click on one of the links on the external site's
page. I'm a bit hesitant about using frames however, but reading up on
them makes me think the application I have in mind for them might be
the generally accepted exception to the rule that frames are bad :)

Anyway. Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top