/    Sign up×
Community /Pin to ProfileBookmark

opening a page into frames

my site is put into a frameset in the index page:

<FRAMESET COLS=”20%,80%”>
<FRAME NAME=”navigate” SRC=”./navigate.html”>
<FRAME NAME=”main” SRC=”./welcome.html”>
</FRAMESET>

I have perused some threads and currently have this working:

<script type=”text/javaScript”>
if (self==parent)
{
parent.location.href=”index.html”;
}
</script>

This opens the site and displays the navigation and welcome pages. (better than some blown out of whack full html page, not to mention nonfunctional)

How do i have the intended page displayed?
I’ve seen this, or similar code used, but can’t quite figure it out.

<script type=”text/javaScript”>
if (self==parent)
{
current = parent.location.href;
parent.location.href=”index.html”;
[B]parent.main.location.href=current[/B];
}
</script>

tried many combinations(switching parent,window; main,top,etc..) but stuck with, has no properties or is not defined.

thanks for taken a look!

to post a comment
JavaScript

18 Comments(s)

Copy linkTweet thisAlerts:
@KorJun 15.2005 — what [b]is[/b] in fact your aim? To prevent opening frames alone?
Copy linkTweet thisAlerts:
@redpopauthorJun 17.2005 — Thanks for checking this out KOR!

as Paul Harvey says "now for the reat of the story"

maybe my title should have been

[B]Properly opening a target page into a frameset[/B]

I am finishing some last touches on our website www.mineralblessings.com

as mentioned above, the site is in a frameset.

while doing keyword analysis, i noticed that Google shows our site in the format of the following.

http://www.mineralblessings.com/oceanjasper.html


when it is clicked on, the page, for example; oceanjasper.html loads as a stand alone page. (This is bad as described above)

after some research i came up with this code right after the body tag.

<script type="text/javaScript">

if (self==parent)

{

parent.location.href="index.html";

}

</script>

this fixes the major problem of having a potential customer open a stand alone page that is worthless for ordering from, but it shows the welcome page just as if www.mineralblessings.com was entered.

I would like to target the main frame within the frameset and open the page that was requested from the search engine.

I've seen this or similar code used:

<script type="text/javaScript">

if (self==parent)

{

current=parent.location.href;

parent.location.href="index.html";

parent.location.href="oceanjasper.html";

}

</script>

this format seems to put the page in a deadly loop.

not sure what the last line should be so that oceanjasper.html is opened into the frame named "main"

thanks again
Copy linkTweet thisAlerts:
@Mr_JJun 17.2005 — Please try the following

In the frameset page:

[code=php]<script type="text/javascript">
<!--
function LoadFrame(){
if (self.location.search){
parent.main.location = location.search.substring(1,location.search.length);
}
}
onload = LoadFrame
// -->
</script>

<FRAMESET COLS="20%,80%">
<FRAME NAME="navigate" SRC="./navigate.html">
<FRAME NAME="main" SRC="./welcome.html">
</FRAMESET>
[/code]



The following is place in the head section of the page you want loaded into its frame.


[code=php]<script type="text/javascript">
<!--
if (self == top){
var url = self.location;
self.location = "index.html?" + url;
}
// -->
</script> [/code]
Copy linkTweet thisAlerts:
@redpopauthorJun 20.2005 — it works........

this site is awesome! ?

Mr J, you the man, thanx to kor also
Copy linkTweet thisAlerts:
@redpopauthorJun 20.2005 — that thumbs down thing was a mistake.

trying to figure out all your whistles and bells, SORRY...
Copy linkTweet thisAlerts:
@redpopauthorJun 24.2005 — Thanks Again,

A new challange is at hand.

When the website above: www.mineralblessings.com is entered by a direct page link i.e., www.mineralblessings.com/oceanjasper.html it then becomes

www.mineralblessings.com/index.html?oceanjasper.html everything is cool.

If another page is selected from the navigation frame say, petrifiedwood.html to open into the main window, again all is fine.

When a refresh/reload is done on, petrifiedwood.html or any other subsequent page, the main frame defaults back to oceanjasper.html (the end of the URL /index.html?oceanjasper.html never changes)



thanx......
Copy linkTweet thisAlerts:
@Mr_JJun 24.2005 — The loadframe script and the script that goes into the page loading into the frame should go immediately after the opening HEAD tag, see if it makes a difference.
Copy linkTweet thisAlerts:
@TedraJun 24.2005 — Hi, I would be in need of a little help again....

I am doing a new site, at the moment just basic. but I have a navigation bar. Now my problem is how do I tell that the link in the topframe is going to be shown in the mainframe?

http://de.geocities.com/hexe2_2/testenframe.html is the testframe and ind

http://de.geocities.com/hexe2_2/exmplmenu_var.js are the configurations

can I maybe put these configurations out of the external file into my http://de.geocities.com/hexe2_2/testen.html <-- navigation file?
Copy linkTweet thisAlerts:
@britneJun 24.2005 — Similar Question...

I have a simple drop-down form in one frame of my page that I want to submit the results to a different frame.

The form uses JavaScript to combine the values from the two menus to create a filename. For example, the user selects "A" from the first menu and "1" from the second to create the file "A1.html"

I want this newly created filename to open in the lower frame of the page, not in the frame with the form.

Where do I need to put my 'target' command, or do I need to use a different command altogether?

Thanks a lot!

-Britne

The full page is here: http://www.geocities.com/britne2002/beardesigns/index.html

The page with the code I'm working on is the top frame, or: http://www.geocities.com/britne2002/beardesigns/beartop.html
Copy linkTweet thisAlerts:
@Mr_JJun 24.2005 — Try changing this line

window.location.href = url;

to

parent.bearmain.location=url
Copy linkTweet thisAlerts:
@britneJun 25.2005 — Thanks a bunch, that worked. ?
Copy linkTweet thisAlerts:
@redpopauthorJun 29.2005 — Moved the scripts to the line after the <HEAD> tag.

Getting the same results.

Just to double check; below is what i have on the oceanjasper.html page.

<script type="text/javascript">

<!--

if (self == top){

var url = self.location;

self.location = "index.html?" + oceanjasper.html;

}

// -->

</script>

I don't see the var url used after it was established.

Tried url instead of oceanjasper.html. Adds the whole url behind index

thanks again ?
Copy linkTweet thisAlerts:
@Mr_JJun 30.2005 — I suppose you might be able to use a session cookie to remember the page in the main frame onunload and then when a refresh is done have that page reloaded into the main frame.

Hmm, I give this some thought .....
Copy linkTweet thisAlerts:
@TedraJul 01.2005 — I researched the topic and found something on selfhtml, but thanks Mr J your post brought my in the right direction ?
Copy linkTweet thisAlerts:
@britneJul 02.2005 — Below is my previous post with the page I am working on...

My newest problem is this:

If the user does not select one option or the other, or neither option, and then submits the form, since there is no option value for the category header commands, the form makes a page that is essentially ".html". How do I tell the script/form to redirect the user to the "index.html" page if they don't select options?

I realize that I could assign a value to the default form options and then make corresponding error pages, but that would involve the creation of 22 or so extra pages, and I was hoping there was a simpler way.

Similar Question...

I have a simple drop-down form in one frame of my page that I want to submit the results to a different frame.

The form uses JavaScript to combine the values from the two menus to create a filename. For example, the user selects "A" from the first menu and "1" from the second to create the file "A1.html"

I want this newly created filename to open in the lower frame of the page, not in the frame with the form.

Where do I need to put my 'target' command, or do I need to use a different command altogether?

Thanks a lot!

-Britne

The full page is here: http://www.geocities.com/britne2002/beardesigns/index.html

The page with the code I'm working on is the top frame, or: http://www.geocities.com/britne2002/beardesigns/beartop.html[/QUOTE]
Copy linkTweet thisAlerts:
@Mr_JJul 03.2005 — If you are wanting to redirect if no jewelry has been selected add the following after the function line

[B]if(menu1.options.selectedIndex==0){

parent.bearmain.location="index.html"

return

}[/B]


like so

function combineMenus(frm, menu1, menu2){

if(menu1.options.selectedIndex==0){

parent.bearmain.location="index.html"

return

}

If you are wanting to redirect if no jewelry or colour has been selected add the following after the function line

[B]if(menu1.options.selectedIndex==0||menu2.options.selectedIndex==0){

parent.bearmain.location="index.html"

return

}[/B]
Copy linkTweet thisAlerts:
@britneJul 03.2005 — You're wonderful, thank you.
Copy linkTweet thisAlerts:
@redpopauthorAug 04.2005 — Been away, health issues.

The response from Mr J on 6/30/05 sure does sound as possible/probable solution. I will definitely check into it. Not familiar with cookies, so i'll have to puruse some sites and go to cookie school. Just started CSS schooling on the wc3 site. Will get back to you!

thanks again...
×

Success!

Help @redpop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...