Click here to Skip to main content
       

Web Development

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionLoading web site within another websitememberweinerschizel13 Nov '12 - 14:03 
I would like to have header across the top of my page with links for my website.
 
Then when some links are clicked it would actually load another website within a particular div of the current website.
 
Is this possible?
 
I'm working with wordpress so it's mainly PHP, javascript, and HTML.
 
Specifically I want to display all properties for sale in my area. The properties are maintained on a separate webpage. I do not want to loose the visitor when they go to the separate website... but rather keep my header up so they can easily click back to my website as needed. That's basically what I'm trying to do in a nutshell.
AnswerRe: Loading web site within another websitemembern.podbielski13 Nov '12 - 21:46 
You can use
<iframe>
HTML tag and change it's src attribute
<iframe src="target.html">
by JS code as click event handler.
somelink.onclick =function(event){
iframe.src = event.target.href;
event.preventDefault();
}
No more Mister Nice Guy... >: |

GeneralRe: Loading web site within another websitememberweinerschizel14 Nov '12 - 11:54 
Sweeeeeeeeeeeeeeeeeeeeeeeeeeeeeet worked like a champ Smile | :)
 
I created a new page template in wordpress and put the iframe tag for the body of the page. Here's a link to my test http://www.keystoaz.com/test/... I embedded one of my websites in another one of my websites.
 
I'm curious though... Is there some trick to get the iframe to resize the page so it doesn't nest a scroll bar like that?
 
Thanks!!!
GeneralRe: Loading web site within another websitemembern.podbielski14 Nov '12 - 12:08 
weinerschizel wrote:
I'm curious though... Is there some trick to get the iframe to resize the page so it doesn't nest a scroll bar like that?

What do you mean? I frame has size allowed by page layout. If you give more space to iframe or page within iframe will be less space demanding scroll will disappear. Think of iframe like about browser window: window is to small for page scroll will appear to let you see all the content.
No more Mister Nice Guy... >: |

GeneralRe: Loading web site within another websitememberweinerschizel14 Nov '12 - 12:25 
Yeah that's what I figured... Just thought I would see if there was some sort of script / hack that could re-size the iframe though. Googling doesn't come up with too much either.
 
The page webpage I plan on embedding is a fixed height anyways so it probably won't even matter anyways. (I have to pay $300 / year for the ability to embed it).
GeneralRe: Loading web site within another websitemembern.podbielski14 Nov '12 - 12:38 
It is possible. Try setting style of iframe
$('iframe').css({
'position':'absolute',
'top':'0px',
'left':'0px',
'height':'100%',
'width':'100%'
});
I am not sure about syntax. It's be a while since I manipulated styles with jQuery, so better check it with documentation.
But this should work. Basicly it's setting left-top corner of frame to left-top corner of window, and force iframe to take all available window space.
I did not try this with iframe but I guess this should work like with any other html element.
No more Mister Nice Guy... >: |

AnswerRe: Loading web site within another website [modified]memberRichard Deeming14 Nov '12 - 2:04 
If you don't have permission to do this, most website owners will object. They'll either add script to break out of the frame, add headers to prevent their site being loaded in your frame, or possibly even resort to legal action.
 
Somebody tried to do this to CodeProject a few weeks back[^]; the hamsters were not amused!



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer



modified 15 Nov '12 - 7:54.

GeneralRe: Loading web site within another websitememberweinerschizel14 Nov '12 - 7:33 
That sucks.
GeneralRe: Loading web site within another websitememberRichard Deeming14 Nov '12 - 7:42 
I think it's a perfectly reasonable response. If you'd spent time and effort making a really useful site, would you be happy for someone else to display your site surrounded by their branding and adverts?



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: Loading web site within another websitememberS.M. Zamshed Farhan15 Jan '13 - 4:27 
Yes, you may use iframe and within it load an url.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid