Script to open a new browser w/url from a Frame

I looking for a cgi solution to emulate excatly what the "Open frame on new browser" function does.
I have a page with two frames. The left frame contains some links which location will appear on the right frame. I need a button on the left frame that open a new browser with in it, the url that was in the right frame (local or external). It seems that this function cannot be done in javascript.

thanks
fanaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

retsCommented:
Try the following:

<A HREF="/cgi-bin/my.cgi" TARGET="_new">Click</A>

or

<FORM METHOD=POST ACTION="/cgi-bin/my.cgi" TARGET="_new">

...

</FORM>

The CGI should be as follows:

#!/path/to/perl5

print "Location: http://www.myserver.com/thispage.html\n\n";

exit;

By using the target _new you open another window.  By printing nothing but a Location (redirection) header, you fill that new window with the contents of another URL.

-K
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fanaAuthor Commented:
Actually I need to have the new browser open to the url that is currently on the right frame. Not a pre-defined one. The exact action that the function "open frame in new browser" perform. The frame can have a different url each time and can be any url on the net.

Any idea ?

Thank you
0
paul_tCommented:
Do I understand correct that you need _exactly_:

 1. There is 2 windows. Left frame contains some predefined
links (pointed to local and externel domains) + button "Show right".

 2. When pressing link at left frame - url appears at right
frame.

 3. When pressing button - the frame that is currently
loaded to right frame appeares in new Netscape window.

 If yes - it seems doable for JavaScript and I may provide
you with solution.



0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

fanaAuthor Commented:
You understood right except for one thing: the left frame contains predefined links that will show on the right frame but if the users keep following the links in this right frame the url won't be predefined. That's the problem. Apparently for security reason javascipt or even java can't handle it.

this is the javascript expertise on this issue:

** LAST REPLY FROM JAVASCRIPT EXPERT **

You can open ANY url in new window with open() method.
You only can't get current URL of other frame/window
if script and this other frame were loaded from
different servers.
You can't do this with Java too.

The only work around (in theory) I found
is a CGI piping of other server
documents through the same server, where from your script
was loaded. But this way requires server-side pipe script.
I tell this 'in theory' but it's not completly true.
I made such things based on my friends Perl relocation
script, but this script wasn't 100% what I need.

Ideal solution can be script which isn't only pipe
but also parsing HTMLs to adjust links in this HTML
work through this pipe again.
But this isn't easy. In theory it can be done
as Java Servlet.

--

any idea ?
0
paul_tCommented:

 'JAVASCRIPT EXPERT' is more or less correct. The
only thing that I can say is that _correct_ proxying all documents (that he calls 'ideal solution') is impossible
not only on practice but in theory also. But if you want
to provide user with more than one-step browsing - you have
no way than to write such proxy. I wrote such proxy 1 year ago.
It is possible to proxy 90% of tags (no _big_ problem to proxy
<A HREF>. But not 100%. There are not only HREF's in HTML documents.






0
fanaAuthor Commented:
so should I forget about the problem ? impossible ?
0
paul_tCommented:

 If speaking about theoretical solutions. You may
consider :

 1. spying resident program that captures URL's
(using OCR technology, or hacking Netscape internal
structures/messages, or spying status line) when user
presses link from right frame. Then that programm remembers
that link as current. (Monitoring "Error connecting"
dialogs and making many beautiful things).

 2. When user presses button "Show Right" at the left
frame - this request goes to that spying proxy, and
it opens new Netsacpe window from command line with
url that was remembered  ;)

 There is no impossible things. Everything is possible ;)
But... From my point of view it's better to count this
solution to be the same as "Yes, impossible".


0
fanaAuthor Commented:
thanks for your enlightening comments and advices !
I'll forget about it for now

0
paul_tCommented:
some days later....

********************

There is workaround that allows to break that security
barrier in Netscape v 3.0 (but this will work with
Netscape 3.0 _only_). I tried this and it works.
If you are interested in code - reject current answere
to give me ability to submit working code.

********************

http://home.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html

Enabling tainting

To enable data tainting, the end user sets the NS_ENABLE_TAINT
environment variable as follows:

     On Unix, use the setenv command in csh.
     On Windows, use set in autoexec.bat or NT user settings.
     On Macintosh, edit the resource with type "Envi" and number 128 in
the
     Netscape application by removing the two ascii slashes "//" before
the
     NS_ENABLE_TAINT text at the end of the resource.

NS_ENABLE_TAINT can have any value; "1" will do.

If the end user does not enable tainting and a script attempts to access

properties
of a window on another server, a message is displayed indicating that
access is
not allowed.

To determine whether tainting is enabled, use the taintEnabled method.
The
following code executes function1 if data tainting is enabled; otherwise
it
executes function2.

if (navigator.taintEnabled()) {
   function1()
}
else function2()


0
fanaAuthor Commented:
thank you. how do I reject the other answers. I'll be glad too

Fana
0
paul_tCommented:
to reject current answere and to make 'locked' question
to become 'opened' you shall chooze 'open for
another experts' or alike. Don't remember exactly.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.