|
-
Aug 29th, 2011, 08:57 AM
#1
Master/child page layout - embed third party website as child page
Hi,
I have a web application that uses the master/child page layout you get by default (at least in a VS2010 web project). The Masterpage has a NavigationMenu, each item on that NavigationMenu has a NavigateUrl that looks like "~/Pages/MyPage.aspx". This automatically opens 'MyPage' in the Content of the Masterpage, so that the master page with menu and header etc stays visible.
Now, the client has a guestbook on her old website (I'm basically rebuilding her website, adding the ability for her to upload new content in her browser), and she wants to keep it. This guestbook is from a 'free guestbook' third party website, over which I have no control. It's simply a website in the form 'http://www.onlinegastenboek.nl/Username" which shows the guestbook for a user 'Username'.
In her old website, I was using frames, so the menu on the left side was in a different frame, and I would simply open the third party website in the center frame. That would create the illusion that the guestbook was on her site, while it was actually a completely different website in a separate frame.
In my new website I'm no longer using frames, but the master/child layout as explained. Is it still possible to 'host' or 'embed' this third party website as a 'child' of the master page?
I tried just putting the url to the guestbook in the NavigateUrl of a NavigationMenu item, but that doesn't work, it just navigates to the third party website and doesn't embed it in any way.
Is it possible what I'm asking?
Thanks!
-
Aug 30th, 2011, 03:33 AM
#2
Re: Master/child page layout - embed third party website as child page
Hello,
In order to continue to use the Master Page, the Content Page has to reference the Master Page in order for it to render the content of the Master Page. Since you can't control the Guest Book pages, this approach is not going to work.
The only thing that I can think that will work would be the following.
Create a Content Page, referencing the Master Page, and in this Content Page have an iFrame that consumes the whole page. Reference this Content Page from your navigation menu, and when it loads, set the src/location of the iFrame to the URL for the Guest Book page.
Hope that helps!
Gary
-
Aug 30th, 2011, 03:45 AM
#3
Re: Master/child page layout - embed third party website as child page
Thanks Gary.
I had already been pointed to the iFrame approach (by our very own JuggaloBrotha ) and it does seem to work. It was a little more difficult; the guestbook website seems to rewrite the url into a querystring and once inside the iFrame it no longer did that, so I had to get the real url and use that, but once I figured that out it seems to work.
Only problem is that the iFrame doesn't take up the whole available height in IE (it does in Chrome), which seems to be a common problem because it wants a container to fill to (and there is none). I'm just setting a height of 1000 pixels now and let the user scroll the guestbook, it's fine I guess but it'd be better to have the page stretch to the height of the guestbook so that there's only one scrollbar, instead of two...
-
Aug 30th, 2011, 03:49 AM
#4
Re: Master/child page layout - embed third party website as child page
Can you show the markup you are using with your Content Page?
You could possibly nest the iFrame in a DIV and control the size of the DIV, rather than the iFrame.
Gary
-
Aug 30th, 2011, 03:58 AM
#5
Re: Master/child page layout - embed third party website as child page
The markup is just
Code:
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Gastenboek.aspx.vb" Inherits="CSLimitedEdition.Gastenboek" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<iframe frameborder="0" style="height:1000px;Width:100%;" src="http://www.onlinegastenboek.nl/gastenboek_.php?username=CSLimitedEdition">
<p>Your browser does not support iframes.</p>
</iframe>
</asp:Content>
I can put the iframe in a div and set that to 100% height, but that doesn't work either. If the contents of the iFrame (the guestbook website) is higher than the page I want to stretch the page (the entire master page).
-
Aug 30th, 2011, 04:08 AM
#6
Re: Master/child page layout - embed third party website as child page
Ah, I see what you mean. In which case, you want to set the scrolling property of the iFrame.
Have a look here:
http://www.w3schools.com/tags/att_iframe_scrolling.asp
For an example.
Gary
-
Aug 30th, 2011, 04:09 AM
#7
Re: Master/child page layout - embed third party website as child page
Hmm, although, that is still not an ideal situation 
Let me have a think about this one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|