Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 1997-12-28
11
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 1

Accepted Solution

by:
rets earned 200 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
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 

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
 

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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…
Suggested Courses

610 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