• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Open url in a default browser

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want the url to open in the default browser of the client. Can anyone help me how to achieve this.. I want to do this on Client side... Can we do this on Javascript.. Please suggest. I am just stuck in here...
I am able to get the alert with the url but just not able to open a new window in default browser...
<script type="text/javascript"><![CDATA[
function test(tbxss){
alert('testing' + tbxss);
java.lang.Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + tbxss);
}



]]></script>
 
Marshal
Posts: 75878
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javascript is usually discussed elsewhere. Moving.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not going to be opening a window with java markup inside of JavaScript.

You probably want to use window.open("url"); or window.location.href("url");

Eric
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cross Posted here: https://coderanch.com/t/436205/JSP/java/url-open-default-browser-client

[edit - removed comment]
 
Vaishali soneta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried window.open(url) or window.location.href(url) but it works only in the firefox and not in googlechrome, adobeair and IE.. and basically it should open in a user's default browser.. So any help would be appreciated
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will open up in the browser the user is currently using. Why would you want to open up Firefox if the user is in chrome? Sounds funny and most people's default browser is the one they use.

Eric
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vaishali soneta wrote:I tried window.open(url) or window.location.href(url) but it works only in the firefox and not in googlechrome, adobeair and IE.. and basically it should open in a user's default browser.. So any help would be appreciated


So IE is your default browser. Why do you want to open it in the default browser instead of the current browser? This makes no sense and is generally very bad for user experience.

You can't do this with JS. Best what you can do is creating a Java application which makes use of Desktop#browse() and embed it as an applet or webstart app in your JSP.
reply
    Bookmark Topic Watch Topic
  • New Topic