By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Can Javascript do this (follow up)

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Rob Gordon <ro****@caltrade.com> writes:
<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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
In article <5h********************************@4ax.com>,
ro****@caltrade.com enlightened us with...

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.

--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3

P: n/a
In article <5h********************************@4ax.com>,
ro****@caltrade.com enlightened us with...
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. :)

--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4

P: n/a
kaeli hi kitbet:
In article <5h********************************@4ax.com>,
ro****@caltrade.com enlightened us with...
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. :)


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.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #5

P: n/a
In article <bp*************@ID-174912.news.uni-berlin.de>,
la****@hotmail.com enlightened us with...

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.

Thanks!


--
--
~kaeli~
Bakers trade bread recipes on a knead-to-know basis.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #6

P: n/a
On Sat, 22 Nov 2003 16:57:05 -0600, kaeli
> Oh, and I'm a girl. :)


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
Jul 20 '05 #7

P: n/a
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/navig...-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/navig...gateScript.htm

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

Cheers

Rob
Jul 20 '05 #8

P: n/a
In article <3u********************************@4ax.com>,
ro****@caltrade.com enlightened us with...
On Sat, 22 Nov 2003 16:57:05 -0600, kaeli
> Oh, and I'm a girl. :)


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!

--
--
~kaeli~
Press any key to continue or any other key to quit
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.