|
Posted by Thomas Menzel on 12/21/24 11:23
"Disco Octopus" <discooctopus@yahoo.com> schrieb im Newsbeitrag
news:mn.42137d584181cc60.23459@yahoo.com...
> Thomas Menzel wrote :
>> "Safalra" <usenet@safalra.com> schrieb im Newsbeitrag
>> news:1123441137.033818.215560@g14g2000cwa.googlegroups.com...
>>> Thomas Menzel wrote:
>>>> I have two pages: Page 1 contains a IFrame with page 2. If i load page
>>>> 2
>>>> direct into the browser page 1 should be loaded automaticly. How can I
>>>> do
>>>> this? Do I need JavaScript?
>>>
>>> You could do it with Javascript, but obviously that would depend on the
>>> user having Javascript enabled (with permissions to force a reload).
>>> You don't give much context, but in most cases server-side includes are
>>> better than using iframes, if your host supports them.
>>>
>>
>> What Javascript should I use? My Code from Page 1:
>>
>> <iframe src="page2.htm" id="xyz" name="xyz" width="100%" height="400"
>> frameborder="0">
>> <p><a href="page2.htm" target="_blank">Show page2</a></p>
>> </iframe>
>>
>> Page 2 is a simple HTML-Page. A very big file, so I can't use server-side
>> includes. Loading would take too long.
>
> i am not sure why that is a reason to avoid SSIs. either way, the page
> must be loaded to the client!
>
> Here is the javascript method. in my opinion a bit yuck, but when i was
> testing this type of stuff (long long ago), i found that it was just one
> of those things that was nice to know how to do........
>
> in your child page (IFrame) put this in it....
>
> <script type="text/javascript">
> function iamchild(){
> if (top.location.href.indexOf("name_of_main_page.html") < 0){
> top.location.replace("name_of_main_page.html");
> }
> }
> </script>
> </head>
>
> <body onload="iamchild()">
Thank you. That is the solution. It works great!
Navigation:
[Reply to this message]
|