aelessedil
asked on
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.
Here is a related MS JS doc:
http://msdn.microsoft.com/library/partbook/asp/windowobjectmethods.htm
http://msdn.microsoft.com/library/partbook/asp/windowobjectmethods.htm
simply superb
ASKER
I need the actual JAVA version as I have to include this into an existing JAVA application and not using HTML to target from.
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,'NewWindow Name','hei ght=550,wi dth=480,me nubar=1,to olbar=0,st atus=1,scr ollbars=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>
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,'NewWindow
newWinUrl = url
}
else
newWinHandle.location.href
newWinHandle.focus()
}
</script>
</head>
<body>
<script language="JavaScript">
openWin('realURL.htm');
self.close()
</script>
</body>
</html>
ASKER
I can't use JAVASCRIPT. I need the JAVA code for the first JAVASCRIPT you posted.
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.
A hard question indeed. I'll be surprised if someone can come up with a solution.
Why dont you try
runtime.exec( "netscape.exe <URL>" );
You might get exception.
"java.io.IOException: CreateProcess:..."
Make sure you have set PATH correctly.
Hi aelessedil,
I dont mind if you reject answers, but
please try to give comment on why the
answer was rejected.
- Vish
ASKER
The answer was rejected because I specified IE (Internet Explorer)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Vish, I thought the point of this thread is to open a browser window without "toolbar"...
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
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,'NewWindow
newWinUrl = url
}
else
newWinHandle.location.href
newWinHandle.focus()
}
</script>
</head>
<body>
<form>
<input type="button" value="Open Window" onclick="openWin(document.
</form>
</body>
</html>