I have two different application having different domains, want to make a s开发者_如何学JAVAite where its show both sites in a single page.[Without using Iframe].
You could use good old frames (not IFRAME):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>This & That</title>
</head>
<frameset cols="50%,50%">
<frame src="http://site1.example.com/">
<frame src="http://site2.example.com/">
</frameset>
</html>
Too bad - IFRAMEs would be a simple and effective solution.
Another reasonably simple solution would be to use a 3rd server, one of your own, to aggregate pages from the other two.
I can't think of a sensible way to do this in the client browser without IFRAMEs.
Check out this example in DynamicDrive website. It uses AJAX to dynamically load the content of an HTML page into a DIV element. This will only work for local files (trying to include one page into another page on the same domain), but if you may use PHP on server-side, you can use jQuery to solve this out (check out this article).
you cannot not display diffrent domains in the same page without iframes or frames. The cannot be bceuse of browser security.
<h1>Welcome to site A</h1>
Here is the weather from site B <hr />
<?php
include("http://siteb.com/weather.htm");
?>
Of course, in practice you'd need to parse the DOM returned from siteB to ensure that the composite output was well formed - i.e. stripping out the ... and XML sugar. And strip out or erqrite any references to files on siteb contained within the HTML - such as javascript, images etc.
And bear in mind that this is going to break any fancy CSS.
C.
精彩评论