473,395 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Opening browser from Java

Hi,

I want to open a browser and place it and size it as I wish,when user selects an option from the menu written in java.
I tried passing command line argument rundll32 url.dll,FileProtocolHandler<url>
in windows 2000 it works fine.But in Xp it doesn't work.Can anyone help me out .

Is there any other way of invoking browser from java application or applet to open a browser which should be positioned and resized as we want(no jdic browser).?

Latheef
Jun 22 '06 #1
2 3302
Oh I remember this one from one of my project I was doing that might do the trick. you basically need to pass ? at the end of the url string if the OSVersion is greater then 5.0

Expand|Select|Wrap|Line Numbers
  1. //// url variable contains the url string address ie http://www.bbc.co.uk
  2.  
  3. // If in win2k and http, the cmd must end with a "?"!
  4. float OSVersion = Float.parseFloat(System.getProperty("os.version"));
  5. if (OSVersion >= 5.0f && url.toLowerCase().startsWith("http")) {
  6.     url = url + "?";
  7. }
  8.  
  9. String cmd = "rundll32 url.dll,FileProtocolHandler " + url + "";
  10. Process r = Runtime.getRuntime().exec(cmd);
  11.  
As for the position of the browser window -- sorry, haven't a clue about that.
Jul 4 '06 #2
Thanks for the reply.
What I pass in cmd is:
javascript:window.resizeTo(550,602);window.moveTo( 550,138);location.href="http://yahoo.com"
But it does n't work in windows XP-sp2.This one works in 2000.
Any idea!
Jul 17 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Prasanth Dash | last post by:
I want to open the browser from a stand-alone java application. How to do it? anybody pl jelp me. thanks Prasanth
4
by: zach | last post by:
Hi My problem is that on some sites when I click on a picture (for example) that is supposed to open in a new window it doesn't. The bottom left of my browser where it tells what is happening...
5
by: Mark Rae | last post by:
Hi, I'm writing a web app in VS.NET 2003, part of which allows users to download reports in the form of XML documents to their local machine for further processing. I'm using a 3rd-party Java...
4
by: Guern1 | last post by:
Hi Need a bit of help here please to point me in the right direction. I have a java class file here which i wish from a menu item to open a web page which contains a help page. ] } else...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.