Solved

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

Posted on 1997-12-28
11
281 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:fana
  • 5
  • 5
11 Comments
 
LVL 1

Accepted Solution

by:
rets earned 100 total points
ID: 1831767
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
 

Author Comment

by:fana
ID: 1831768
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
 
LVL 2

Expert Comment

by:paul_t
ID: 1831769
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
 

Author Comment

by:fana
ID: 1831770
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
 
LVL 2

Expert Comment

by:paul_t
ID: 1831771

 '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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:fana
ID: 1831772
so should I forget about the problem ? impossible ?
0
 
LVL 2

Expert Comment

by:paul_t
ID: 1831773

 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
 

Author Comment

by:fana
ID: 1831774
thanks for your enlightening comments and advices !
I'll forget about it for now

0
 
LVL 2

Expert Comment

by:paul_t
ID: 1831775
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
 

Author Comment

by:fana
ID: 1831776
thank you. how do I reject the other answers. I'll be glad too

Fana
0
 
LVL 2

Expert Comment

by:paul_t
ID: 1831777
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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now