Sub-pages should open in an Inline Frame

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Sub-pages should open in an Inline Frame

Post by kees » Wed May 24, 2006 10:34 pm

Suppose you create your site using an Inline Frame with several sub-pages. How can you assure that the sub-pages are always opened inside the Inline Frame?

Let's assume that the main-page is called index.html, the Inline Frame is called IFrameName, the default sub-page is called sub_1.html and that all pages are in one directory.

First all sub-pages need some JavaScript.
1. Bring up the Page HTML dialogue, select 'Between Head Tag' and insert this:

Code: Select all

<script type="text/javascript">
 if (self == top) top.location.href = './index.html?' + escape(self.location);
</script>
Then the index-file (with the iframe) needs some changes.
2. Bring up the Inline Frame Properties dialogue and change it to:
- Name: IFrameName
- Link To: Web Site
- URL: empty, remove all text
3. Bring up the Page HTML dialogue.
3a. Select 'Between Head Tag' and insert this:

Code: Select all

<script type="text/javascript">
 if (top != self) top.location = self.location;
 var file = location.search ? unescape(location.search.substring(1)) : "./sub_1.html";
</script>
3b. Select 'Inside Body Tag' and insert this:

Code: Select all

onLoad = "self.IFrameName.location.href = file"
Note:
Seeing that the inserted JavaScript also works when you preview the page, you must set the 'Preview Scope' to 'Entire Web Site' (Tools->Options->Preview). A sub-page always calls up the main index.html .

Patr100
 
 
Posts: 308
Joined: Tue Dec 25, 2007 10:52 pm

Post by Patr100 » Sun Mar 23, 2008 11:48 pm

I've been looking at this. For various reasons I have had to produce a page with another program outside of WB5 (which I cannot import) and so it is in another folder.
How would this need to be altered to do the same?

-

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Mon Mar 24, 2008 12:11 am

If the concerning page is a sub-page (shown in the Inline Frame), then you must insert the code at step 1.
This code must be placed between <head> and </head>.

If the concerning page is in a folder, then replace

Code: Select all

./index.html
with

Code: Select all

/index.html

genieuk
 
 
Posts: 148
Joined: Fri Mar 06, 2009 2:10 am

Post by genieuk » Sun Mar 15, 2009 5:06 pm

Hi,

I been looking for something like this.

Some questions thou.

The first piece of code in your post,

Code: Select all

<script type="text/javascript">
 if (self == top) top.location.href = './index.html?' + escape(self.location);
</script>
where it says /index.html?

do i replace that with the page i want people to be taken to?

My inline frame is on a page called tutorials.php so do i replace index.html with tutorials.php ?

also what about the ? after the .html do i need to keep that there?

and this code:

Code: Select all

<script type="text/javascript">
 if (top != self) top.location = self.location;
 var file = location.search ? unescape(location.search.substring(1)) : "./sub_1.html";
</script>
where it says sub_1.html

do i replace that with the main webpage page name that is opended in the inline frame?

If you look here you will see what i am trying to do, it may make it more clear

viewtopic.php?t=17629

Thank you,
Mathew

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Sun Mar 15, 2009 5:18 pm

genieuk wrote:My inline frame is on a page called tutorials.php so do i replace index.html with tutorials.php ?
Yes.
genieuk wrote:also what about the ? after the .html do i need to keep that there?
Yes, of course. Why else should it be there?
genieuk wrote:where it says sub_1.html
do i replace that with the main webpage page name that is opended in the inline frame?
Yes.

All these questions are explained in the article:
Let's assume that the main-page is called index.html, the Inline Frame is called IFrameName, the default sub-page is called sub_1.html and that all pages are in one directory.

genieuk
 
 
Posts: 148
Joined: Fri Mar 06, 2009 2:10 am

Post by genieuk » Mon Mar 16, 2009 12:23 am

Am i missing something here?

When for example someone clicks on the webpage link in google that is in an iframe it will show the page with no navigation menu etc,

i want so when someone accesses the URL directly it takes them to the page where the inline frame is,

i have tutorials.php that has a slide menu and inline on it, when someone clicks on example clean-install in slide menu it shows the clean-install.html webpage in the inline frame.

now if i access the link directly it will show a rather horrible page as it has no navigation menu etc.

now is this tip suppose to when someone tries accessing the page directly redirect them to tutorials.php in my example so they cannot view the page directly with no navigation menu etc?

i done what was said, and if i access page directly well i see nothing different. It does not take me back to page where the inlineframe is or anything

Thanks
Mat

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Mon Mar 16, 2009 6:33 am

genieuk wrote:now is this tip suppose to when someone tries accessing the page directly redirect them to tutorials.php in my example so they cannot view the page directly with no navigation menu etc
Yes.

What is the url of your site? Then we can take a look at what you did.

genieuk
 
 
Posts: 148
Joined: Fri Mar 06, 2009 2:10 am

Post by genieuk » Mon Mar 16, 2009 10:13 am

Hi,

It does work i got it mixed around stupid me.

when i tried accessing the vista-clean-install.html page it took me to the tutorials.php page.

when i tried accessing the vista-clean-install.html directly it redirected to iframe page (tutorials.php) and the link looked like this: (i removed my url)

http://www.mydomain.com/tutorials/tutor ... stall.html

Is it possible for it, when it takes you to the page the iframe is on for it to select the page the person originall wanted to see?

I was thinking, if someone clicked on a link in google let's say, now it will re-direct them to the page where the iframe is, this is great of course but wondering could it also select the page they wanted to view in the iframe on redirection?

or is it not possible?

Thank you,
Mathew

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Mon Mar 16, 2009 2:51 pm

genieuk wrote:Is it possible for it, when it takes you to the page the iframe is on for it to select the page the person originall wanted to see?
That's exactly how it works. Doesn't it work that way on your site?

genieuk
 
 
Posts: 148
Joined: Fri Mar 06, 2009 2:10 am

Post by genieuk » Mon Mar 16, 2009 4:53 pm

HI,

No, what it does is if i directly access the page it takes me to the tutorials.php page which has the iframe on but does not load the page in the iframe unless the user clicks on the tutorial they want on the slide menu.

Here you go

Link Removed - Site Not Yet Done ;)

see there, that is the page with i frame.

Now, click on any of the tutorials in the slide menu, it will of course load in iframe, for example click on vista clean install.

but it wont load the tutorial in the iframe.

Thank you,
Mathew
Last edited by genieuk on Mon Mar 16, 2009 6:40 pm, edited 1 time in total.

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Mon Mar 16, 2009 6:31 pm

In step 3b you inserted this:

Code: Select all

onLoad = "self.IFrameName.location.href = file"
But the name of your Inline Frame is not IFameName. Your Inline Frame is named InlineFrame1.

The name in the code must be the same as the Inline Frame name.

genieuk
 
 
Posts: 148
Joined: Fri Mar 06, 2009 2:10 am

Post by genieuk » Mon Mar 16, 2009 6:39 pm

Thank you,

Works Perfect.

Sorry, i dont know how i did not miss that,

Thanks ever so much :D

Mathew

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Sun Apr 26, 2009 5:30 pm

cajosx wrote:and how to use this code in several pages ?
Step 1 should be done for all sub-pages.
cajosx wrote:And if have more than one inlineframe, do i have the code to each iframe ?.
Yes.
The name of the concerning Inline Frame should be adapted in step 3b.
But mind this solution does not work for multiple Inline Frames on one page.
cajosx wrote:Does google index the content ?.
Google will index all pages that can be found by following normal hyperlinks. Google does not find pages via JavaScript navigation.
So, if you have JavaScript navigation, also include the 'Text menu' on your pages.

Patr100
 
 
Posts: 308
Joined: Tue Dec 25, 2007 10:52 pm

Post by Patr100 » Thu Jun 04, 2009 7:41 pm

I just added the necessary first part

Code: Select all

<script type="text/javascript"> 
 if (self == top) top.location.href = './index.html?' + escape(self.location); 
</script
to my subpage and previewed and it already seems to work OK so do I really need the additional script on the inline frame page itself?

User avatar
kees
 
Posts: 49
Joined: Mon May 23, 2005 7:36 pm
Location: Soest - NL

Post by kees » Thu Jun 04, 2009 8:09 pm

If you only add the code on the subpage, then the main page will be loaded plus the default subpage.

If you want the chosen subpage in the Inline Frame, then you should perform the steps for the main page.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest