Can Javascript do this (follow up)

R

Rob Gordon

Hat's off to Kaeli!

I've been trying for months to get some code that would allow me to
break the contents out of the main frame in my frame based navigation
system- and he has almost solved this problem with just a few lines of
code:

<a href="#" onClick="window.open(top.frames
['mainFrameName'].document.location,'','');return false;">click here
to open the document in a new window</a>

The only thing wrong with this is it only works for web pages already
on my server. If an external link is displayed in the main frame
window then this doesn't work- and clicking the "new window" button
will cause the footer frame to be displayed in the main frame instead.

I'm not a programmer and this may just be a small fix- if anyone else
could give me a small hand I would really appreciate it. The function
is currently in the portal below if you want to see what it is doing.

Cheers

Rob

http://www.caltrade.com




Hi all,

I have a web portal I have been developing where I have put together a
fairly nice navigation system using frames. There is a left hand
menu, a "main" frame and a header and footer frame. Everything url
that a user clicks is displayed in the "main frame". I want to give
my users a function called "New Window" in the footer frame that will
"break" the main frame and open whatever is there in a separate
window. This will allow me to add more interesting contents since I
will no longer be "trapping" people in my frame system.

The problem is I don't know Javascript and my venture is not funded so
I can't pay anything right now but I would be very grateful is someone
knows if there is an easy way to do this. I tried to explain this to
some programmer friends of mine but I'm not sure we communicated
because they recommended what seemed like a complimented and involved
approach.

At first I was trying to find a function that would "look at" whatever
iis in the main frame and open it in a new window. I've looked at
this issue again, and I think it can be solved a different way without
referirng to "frames" at all. Would it be possible to write a
function in Javascript that would "remember" whatever the last url
clicked, and then open this in a new window? I think this would do
the exact same thing. My portal is at the link below if you want to
see why I need this.

Thank you

Rob

http://www.caltrade.com
 
L

Lasse Reichstein Nielsen

Rob Gordon said:
<a href="#" onClick="window.open(top.frames
['mainFrameName'].document.location,'','');return false;">click here
to open the document in a new window</a>

The only thing wrong with this is it only works for web pages already
on my server. ....
I'm not a programmer and this may just be a small fix- if anyone else
could give me a small hand I would really appreciate it.

There is no fix. It is part of the security model of most modern
browsers: code from one domain cannot access the contents of documents
from other domains.
There is no workaround (and if there is, expect it to be patched at
some time, as the bug it is).

/L
 
K

kaeli

I'm not a programmer and this may just be a small fix- if anyone else
could give me a small hand I would really appreciate it. The function
is currently in the portal below if you want to see what it is doing.

Check out the code used by about.com. :)
It's complicated and I'm not totally sure how they do it (they
obfuscated the script, which can be deobfuscated, but i don't have time
right now), but they keep track of where the user is and have a link
that has target=_top in it.
 
K

kaeli

Hat's off to Kaeli!

I've been trying for months to get some code that would allow me to
break the contents out of the main frame in my frame based navigation
system- and he has almost solved this problem with just a few lines of
code:

Oh, and I'm a girl. :)
 
F

Fabian

kaeli hi kitbet:
Oh, and I'm a girl. :)

Had a look at your site. Love the wallpapers. But the link to the
blue-tinted tiger needs fixing - it is pointing to its own thumbnail.
 
R

Rob Gordon

On Sat, 22 Nov 2003 15:21:50 -0600, kaeli wrote:

Check out the code used by about.com. :)It's complicated and I'm not
totally sure how they do it (they obfuscated the script, which can be
deobfuscated, but i don't have time >right now), but they keep track
of where the user is and have a link >that has target=_top in it.
***************
Hi Miss Kaeli- or whoever else might have thoughts on this.

I checked out "about.com" and I am pretty sure that is "frame
branding" - which isn't exactly what I want. I thought I remembered
seeing that in Java Script source and just went back and found it:
http://javascript.internet.com/navigation/frame-branding.html

While I was there I found a script much closer to my needs- It allows
you to navigate a frame from another frame with forward and back
buttons- but no "new window" and it probably can't do external links
either.
http://javascript.internet.com/navigation/NavigateScript.htm

Any creative or "out of the box" solutions to this are also welcome.

Cheers

Rob
 
K

kaeli

Well you certainly are a smart girl! I'll check out the About site.
Would a possible approach be for a Javascript program that could
"remember" the last url clicked for the main frame? Anyway thanks for
your help.

Rob

I honestly don't know a way b/c of security concerns, but the user can
always open the link in the new window themselves by right-clicking and
choosing "open link in new window". :)

Good luck!

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top