14 Replies - 53680 Views - Last Post: 14 December 2009 - 06:47 AM

#1 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Embed Webpage within a Webpage

Posted 29 January 2007 - 03:57 PM

What I'm looking to do is embed a one webpage within another webpage. I know its possible and i am already using Inline Frames a little, but what i really need is something that will embed the page and be able to change size depending on the page.

Does anyone know if this is possible?
Is This A Good Question/Topic? 0
  • +

Replies To: Embed Webpage within a Webpage

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Embed Webpage within a Webpage

Posted 29 January 2007 - 05:04 PM

Do you have access to any server side languages? PHP, ASP, etc.?
Was This Post Helpful? 0
  • +
  • -

#3 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 30 January 2007 - 06:42 AM

I know a little PHP, is there no premade applet or something that can do this for me?
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Embed Webpage within a Webpage

Posted 30 January 2007 - 07:10 AM

I'm sure there is somewhere. You could check at hotscripts.com. Could you just include a picture of the page, i.e. a screen shot? Or do you want to include it like a frame with the entire page?

There are PHP functions that allow you to "get" a page then output all the HTML it gets inline with the rest of your page. If that's a viable option, I can find the function for you, it's pretty easy if I recall.
Was This Post Helpful? 0
  • +
  • -

#5 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 30 January 2007 - 08:34 AM

View Postskyhawk133, on 30 Jan, 2007 - 07:10 AM, said:

There are PHP functions that allow you to "get" a page then output all the HTML it gets inline with the rest of your page. If that's a viable option, I can find the function for you, it's pretty easy if I recall.


Could that be done in such a way that when a link is clicked, the target page's html is put into the page?
Was This Post Helpful? 0
  • +
  • -

#6 lance  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 30-January 07

Re: Embed Webpage within a Webpage

Posted 30 January 2007 - 07:18 PM

Hi there,

There are a lot of ways

1. Frames - the traditional way
2. PHP -
either through include or if you wish to have Apache parse php code on .html pages
3. AJAX & JS - content can be included and works just like normal i.e. links bla bla bla all work in the same page.

Let me know if you want me to elaborate on any of these.
Was This Post Helpful? 0
  • +
  • -

#7 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Embed Webpage within a Webpage

Posted 30 January 2007 - 07:36 PM

iframes are really the easiest way to do what you're trying to do. Doing anything else requires retooling the page with some programming language before the user can use it.
Was This Post Helpful? 0
  • +
  • -

#8 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 31 January 2007 - 01:43 AM

Well, it would be brilliant if you guys could find me a tutorial covering one of these things. I assume by "iframes" you mean inline frames. I've used inline frames before but what i really need is an iframe that dynamically changes size depending on the requested content.
Was This Post Helpful? 0
  • +
  • -

#9 lance  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 30-January 07

Re: Embed Webpage within a Webpage

Posted 31 January 2007 - 11:55 PM

1. PHP Way

Add this to the .htaccess file at the root of your site:
AddType application/x-httpd-php .php .html

Then use:
<?
include("filename.html");
?>

Your HTML pages can now have content from other pages.

2. Add this code to the <head> of every page you wish to include the other pages content in:

<script type="text/javascript">

/***********************************************
* Add this code to the <head> of every page you wish to include the other pages content in
***********************************************/

//To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.

var rootdomain="http://"+window.location.hostname

function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously 
page_request.send(null)
writecontent(page_request)
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}
</script>



The just add this code wherever you want the other pages content to appear:
<script type="text/javascript">
ajaxinclude("header.html")
</script>


3. Use inline frames as suggestede by others :)
Was This Post Helpful? 1

#10 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 01 February 2007 - 01:49 AM

I'll try the second of your ideas when i get home from college. You lost me completely with the php thing and iframes are a last resort.

With the javascript method of doing it, will the content have a target (like the current browser window is _self)?
Was This Post Helpful? 0
  • +
  • -

#11 lance  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 30-January 07

Re: Embed Webpage within a Webpage

Posted 01 February 2007 - 03:00 AM

The links will open in the same window unless you have specified another target. Live example

This post has been edited by lance: 01 February 2007 - 03:00 AM

Was This Post Helpful? 0
  • +
  • -

#12 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 01 February 2007 - 09:21 AM

View Postlance, on 1 Feb, 2007 - 03:00 AM, said:

The links will open in the same window unless you have specified another target. Live example


On my webpage i have my links on the index page, but i want the content to be shown in the center of the page when one of the links is clicked.

Using your method of displaying annother pages content on the current page, is it possible to have the links target that content?
Was This Post Helpful? 0
  • +
  • -

#13 theholygod  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 342
  • Joined: 05-February 06

Re: Embed Webpage within a Webpage

Posted 03 February 2007 - 03:16 AM

Ok, i did a lot of research last night and i managed to find this:
http://www.programmi...hp/t-25995.html

<script language="Javascript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentwindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->


and then

<iframe name="the_iframe" onload="calcHeight();" scrolling="no" width="730" id="the_iframe" src="my_page.html" frameborder="0" allowtransparency="true"></iframe>


I put this into a blank html file and it seemed to work in firefox (although the chunk that goes in the header was printed as text across the page) and didnt work in IE at all.

Im obviously implementing this wrong, can someone please point me in the right direction?
Was This Post Helpful? 1

#14 kunjkp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-September 06

Re: Embed Webpage within a Webpage

Posted 27 February 2009 - 08:23 PM

Excellent work done regarding embedding a page using java script.
But the thing over here is that page should be from the same domain. Kindly help me out how to call a page from another domain...

Thanks
Was This Post Helpful? 0
  • +
  • -

#15 GordonWest  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-December 09

Re: Embed Webpage within a Webpage

Posted 14 December 2009 - 06:47 AM

View Posttheholygod, on 29 Jan, 2007 - 02:57 PM, said:

What I'm looking to do is embed a one webpage within another webpage. I know its possible and i am already using Inline Frames a little, but what i really need is something that will embed the page and be able to change size depending on the page.

Does anyone know if this is possible?


~~~ Google Seach Engine ~~~

<iframe height="410" width="100%" frameBorder="3" src="http://www.google.com.au/webhp?sourceid=navclient&ie=UTF-8/index.php">your browser does not support IFRAMEs</iframe>

I have tried with my luck to find something... I hope this IS what you are trying to find.

*This is my first time here. I had to register, so I can reply.*-*bows deeply*

This post has been edited by GordonWest: 14 December 2009 - 07:11 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1