URLOpen New Instance without Links & Address Bar


I need to find out how to open a new browser instance without all the extra IE toolbars.  I'm calling the URL from a JAVA application and the only parameter I can find is is the URL.
I need the menu bar and the buttons so the user use the print command.

I need the answer ASAP, thus the extra points.
aelessedilAsked:
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.

memingCommented:
Use the window.open(...) method. The String 'height=550,width=480,menubar=1,toolbar=0,status=1,scrollbars=1,resizable=1' should do the trick.  When the value is set to 0 (false), the corresponding property is turned off. 1 is for true.

Here is a complete example:

<html>
<head>
<script language="JavaScript">
var newWinHandle = null
var newWinUrl = ''
function openWin(url)
{
 if (newWinHandle == null || newWinHandle.closed)
 {
   newWinHandle = window.open(url,'NewWindowName','height=550,width=480,menubar=1,toolbar=0,status=1,scrollbars=1,resizable=1')
  newWinUrl = url
 }
 else
  newWinHandle.location.href = newWinUrl
 newWinHandle.focus()
}
</script>
</head>
<body>
<form>
<input type="button" value="Open Window" onclick="openWin(document.location.href)">
</form>
</body>
</html>
0
memingCommented:
0
Ravindra76Commented:
simply superb
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

aelessedilAuthor Commented:
I need the actual JAVA version as I have to include this into an existing JAVA application and not using HTML to target from.
0
memingCommented:
I'm sure that I understand your question this time:

The following page contains a complete example with working demo and complete source code for loading a URL into a frame:
http://java.sun.com/docs/books/tutorial/applet/appletsonly/browser.html

To open a new window, just specify a targetWindow name that doesn't exist, such as "memingNewWin" in the showDocument method:
public void showDocument(java.net.URL url, String targetWindow)

The url that you load may be a page like the following, or you may let the applet write the following as a string to the new window. What happens is that once the page is loaded, it opens another new window with toolbar turned off and close the window that it is currently in. Therefore, you end up with a new window loaded with "realURL.htm" without the toolbar.

<html>
             <head>
             <script language="JavaScript">
             var newWinHandle = null
             var newWinUrl = ''
             function openWin(url)
             {
              if (newWinHandle == null || newWinHandle.closed)
              {
                newWinHandle =
             window.open(url,'NewWindowName','height=550,width=480,menubar=1,toolbar=0,status=1,scrollbars=1,resizable=1')

               newWinUrl = url
              }
              else
               newWinHandle.location.href = newWinUrl
              newWinHandle.focus()
             }
             </script>
             </head>
             <body>
<script language="JavaScript">
  openWin('realURL.htm');
  self.close()
</script>
             </body>
             </html>  

0
aelessedilAuthor Commented:
I can't use JAVASCRIPT.  I need the JAVA code for the first JAVASCRIPT you posted.  
0
memingCommented:
aelessedil, the last anwser I posted includes the java code that opens a browser window with a specified url. In order to hide the toolbar of that window, the only way of doing it is to use javascript's window.open method, unless there is an unpublished Applet-Browser API somewhere.

A hard question indeed. I'll be surprised if someone can come up with a solution.
0
vishoneCommented:

 Why dont you try
      runtime.exec( "netscape.exe <URL>" );

 You might get exception.
      "java.io.IOException: CreateProcess:..."
 Make sure you have set PATH correctly.

0
vishoneCommented:

 Hi aelessedil,

      I dont mind if you reject answers, but
      please try to give comment on why  the
      answer was rejected.

 - Vish
0
aelessedilAuthor Commented:
The answer was rejected because I specified IE (Internet Explorer)
0
vishoneCommented:


      Hi aelessedil,

      This is the working piece of code, for your reference,
      as an example using RUNEXEC

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      

      import java.io.*;
      import java.lang.*;

      public class Iet {
      public static void main( String[] args )
      {
            Runtime runtime = Runtime.getRuntime();
            Process process1 = null;
            try
            {
                    String[] cmd = { "C:\\Progra~1\\Intern~1\\Iexplore.exe" };
                  process1 = runtime.exec( cmd );
            }
            catch ( Exception e )
            {
                  System.err.println( "exec: " + e );
                  e.printStackTrace();
                  System.exit( 1 );
            }
      }
      }

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Assumption is that Internet explorer executale is located
      under C:\Program Files\Internet Explorer directory, that
      is what the "cmd" string contains.

      You can suppress toolbar by specifying toolbar=0 while
      invoking the Internet Explorer

      There is one more version of runtime.exec that takes the
      one more argument as the parameter values for the command
      you are invoking and you can pass url as well as the value
      for the "toolbar" parameter.

      Since I dont have Internet Explorer installed properly,
      I cannot give to complete working code.
      
      For more reference and working piece of source code,
      please visit,
      http://developer.apple.com/qa/java/java12.html

 - Vish
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
memingCommented:
Vish, I thought the point of this thread is to open a browser window without "toolbar"...
0
vishoneCommented:

 Hi meming,

      I guess you have not gone through my
      answer completely.

      While invoking Internet explorer, we
      can pass parameters to control the
      browser, for example if I say
            iexplorer.exe -nohome ..
      browser will not try to access home URL

      Similarly, if i execute
            iexplorer.exe toolbar=0
      Toolbar will not be available on the
      browser. Strangely, this option is
      working with IE3.0 not with IE4., there
      may be some other option to control the
      toolbar.



 Hi aelessedil,
      
      The paragraph which starts with "There
      is one more version of... " is wrong,
      sorry about that, actually you have to
      pass the command and parameters for the
      command in an array of strings to the
      same runexec.

      Also, at the URL I mentioned, there is
      a package called 'BrowserLaunher'
      available, that may be helpful to you.

 - Vish
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
Java

From novice to tech pro — start learning today.