To include a page from another site as part of my page

X

xxgeorge

hi all,


sorry if this is a naive question. I'm writing a JSP page which has
the upper part showing certain information and has the lower part,
maybe a frame, showing a page from another site, say,
www.somewhereelse.com. (that site is owned by us as well, so there
isn't any issue on infringement)

I can do it by pointing the frame to the site. However, I want to
keep this URL secret, so that even if users view the HTML source that
cannot gain any knowledge on the URL.

I'd be great if I can do it in JSP/servlet. Unfortunately, IIRC
servletDispatcher.forward() and servletDispatcher.include() can
applied to pages under the same application only.

Is there anyway I can keep achieve this? Thanks very much for your
help.


george
 
E

Enrique

My response is off-topic, but you can pull this off with Javascript.
Dynamically write the HTML for the frame's src attribute, using
Javascript. To obscure the Javascript, hide it in a hidden frame.
Email privately for details, if you don't know what I mean.
 
X

xxgeorge

Thanks for your advice.


I've done it in another way, simply using response.sendRedirect(). I
should have remembered it :( This is how I do it:


[MainPage.jsp]
<html>
<body>
......
.....
<% session.setAttribute( "showInPage", "Y" ); %>
<iframe src="inPage.jsp"></iframe>
.....
</body>
</html>


[inPage.jsp]
<%
if ( session.setAttribute("showInPage")!=null ) {
response.sendRedirect("www.somewhereelse.com");
}
session.removeAttribute( "showInPage" );
%>


I've put the flag "showInPage" in session so that if users try to
access inPage.jsp directly, they can't access www.somewhereelse.com.


Feel free to discuss
george
 
R

Roedy Green

Is there anyway I can keep achieve this?
You could fetch the page yourself and return it as yours.

You could to a redirect to the page. That hides the source a little
bit.

Here is a mini redirect file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta http-equiv="refresh" content="8; URL=jgloss/jgloss.html">
<title>Document Moved</title>
</head>
<body>
<h1>Document Moved</h1>
<p>
The document you requested <b>http://mindprod.com/jgloss.html</b><br>
is now called <b>
<a
href="http://mindprod.com/jgloss/jgloss.html">http://mindprod.com/jgloss/jgloss.html</a></b>
<p>
If you don't hit your browser's <span class="click">back</span> button
now, you
should be taken there automatically in 8 seconds. You can go there
manually by
clicking the correct URL above.
<hr>
</body>
</html>
 
D

David Lesaffre

xxgeorge said:
I've done it in another way, simply using response.sendRedirect(). I
should have remembered it :( This is how I do it:

Hmm..
I'm not sure about this, but if you ask for the page info (Mozilla), it will
probably show the true origin of the page. After all, a
response.sendRedirect() makes the browser fetch the page from another
location. And if the browser knows this location, and it allows for a user
to retrieve the information about from a page...

It would not show in the HTML source, but I think it will show in the page's
(or frame's) information.
 
X

xxgeorge

thanks for your advice, but I'm not sure if doing it in JavaScript (or
doing it with HTML redirect) is a good way to hide the URL. If I put
the URL in JavaScript, the source will inevitably be downloaded to the
client browser, which means that the users can get it on purpose.

even if I put it in a hidden frame, or in a seperate js file, users
can get the location of js file from the HTML source, download it to
client machine and study it.
 
R

Roedy Green

thanks for your advice, but I'm not sure if doing it in JavaScript (or
doing it with HTML redirect) is a good way to hide the URL. If I put
the URL in JavaScript, the source will inevitably be downloaded to the
client browser, which means that the users can get it on purpose

Why are you trying to disguise that? Usually you want such things
obvious to explain for example why only part of a site appears to be
down.
 
X

xxgeorge

In my case I'm building a page of two halfs, I am responsible for the
content of the upper half, while the content of the lower half is
handled by our partner site, where they don't want to expose their URL
to ordinary users so that users cannot access their site directly.

george
 
R

Roedy Green

In my case I'm building a page of two halfs, I am responsible for the
content of the upper half, while the content of the lower half is
handled by our partner site, where they don't want to expose their URL
to ordinary users so that users cannot access their site directly.

If they want to be really safe, they should block access from anybody
but you. And you should fetch the content from them, and relay it out.
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top