You are here: Re: IFrame « HTML « IT news, forums, messages
Re: IFrame

Posted by Thomas Menzel on 11/12/14 11:23

"Disco Octopus" <discooctopus@yahoo.com> schrieb im Newsbeitrag
news:mn.4a5f7d586182d84d.23459@yahoo.com...
> Thomas Menzel wrote :
>> "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!
>
> You are welcome.
>
> Although this works for you, I would still recommedn a server side script
> to do this instead of client side stuff.

A server side script is in my case not good:

>> If the surrounding page has relevant information it makes sense to
>> display that quickly, while the iframe takes a minute to load.
>
>Yes, you are alright! The user can see the content of the surrounding page
>before the iframe is completely loaded.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация