/    Sign up×
Community /Pin to ProfileBookmark

need help with frames and history property

I am trying to create a web page with 2 frames.
My coding will create the web page but it won’t go to a URL when I click on the Go To button. Also, I already know it will give me an error when trying to go to a website in the history list that isn’t on the same domain as the coding. How can I get the Go To button to work? And the same domain issue?
This is the code for the parent frame:
<!– SiteNavigator.html –>

<HTML>
<HEAD>
<TITLE>Site Navigator</TITLE>
</HEAD>

<FRAMESET ROWS=”75%,25%”>

<FRAME SRC=”” NAME=”main”>
<FRAME SRC=”Controls.html” NAME=”controls”>

</FRAMESET>
</HTMl>

This is the code for the second frame:
<!– Controls.html –>

<HTML>
<HEAD>

<FORM NAME=”controls”>

URL Address:

<INPUT TYPE=”text” NAME=”newURL”>

<INPUT TYPE=”button” NAME=”goto” VALUE=” Go To “
onClick=”parent.main.location.href=document.controls.newURL.value();”>

<INPUT TYPE=”button” NAME=”next” VALUE=” Next URL “
onClick=”parent.main.history.forward();”>

<INPUT TYPE=”button” NAME=”previous” VALUE=” Previous URL “
onClick=”parent.main.history.back();”>

</FORM>
</BODY>
</HTML>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@AdamBrillDec 22.2003 — This part of it should work for you:

<INPUT TYPE="button" NAME="goto" VALUE=" Go To "

onClick="parent.main.location.href=document.controls.newURL.value();">

Are you having problems with that part?

Also, for the other part, I don't believe there is a way to get around the safety features of the browser... If you get an "access denied" error, then that's probably the problem.
Copy linkTweet thisAlerts:
@1christineauthorDec 22.2003 — Adam,

What if I do something like this, to make appear like it will work?

<FRAMESET ROWS="75%,25%">

<FRAME SRC="http://www.google.com" NAME="main">

<FRAME SRC="Controls.html" NAME="controls">

</FRAMESET>

if I set the parent window to Google and then type a URL on the controls page, you are right, it takes me to the URL, but click on the previous, it doesn't work.

my instructor gave us a clue that that each frame contains its own Window object, as well as its own Location, History, and Navigation objects

is there a way to make it work in certain situations? or with just a particular website?
×

Success!

Help @1christine 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...