Solved

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

Posted on 1997-12-28
11
287 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 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.

726 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