LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-29-2005, 12:59 PM   #1
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Rep: Reputation: 15
Post Open HTML file in default browser through C++


Hi, I was just wondering if it is possible in Linux to perform a command where you specify an HTML file and Linux automatically opens it in the default Web Browser. I know more or less how to do it in Windows (as our project should run in Windows & Linux), but I need to know if I can do it in Linux.
Its for Help files.

Thanks
 
Old 09-29-2005, 01:47 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 54
There is no 'default web browser'...this is linux, choice is the order of the day! You'll have to specify the command to open the browser..possibly trying several until one works.
 
Old 09-29-2005, 02:26 PM   #3
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Original Poster
Rep: Reputation: 15
No I mean Linux detects what the user's Browser of choice is like in Windows and when you open the HTML file, Linux opens that Browser.
Also, if the above method can't work, can anyone please give me some tips on alternatives of how to accomplish this?
Thanks
 
Old 09-29-2005, 03:05 PM   #4
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Original Poster
Rep: Reputation: 15
Nevermind, I've found a html help viewer in wxWidgets (the framework I'm using).
So to display help files won't be a prob. But thanks anyway. Although it would be nice to know how to do it.
 
Old 09-30-2005, 02:47 AM   #5
LinuxLala
Senior Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Rep: Reputation: 45
I am a little confused by your post. Do you wish to open a html file or do you wish to view the Compiled Help file (.chm) in linux. .chm is the format used by windows for the help files.

You can use xchm to read .chm files in linux
http://xchm.sourceforge.net/
 
Old 09-30-2005, 06:42 AM   #6
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Original Poster
Rep: Reputation: 15
No, I want to open an HTML file and Linux should open the user-defined WebBrowser.
Its mainly for help files. I don't want to open chm files. I'm just wondering if one can call a function in Linux that can do this in C++.
 
Old 09-30-2005, 11:04 AM   #7
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 54
Quote:
Originally posted by Last Attacker
No I mean Linux detects what the user's Browser of choice is like in Windows and when you open the HTML file, Linux opens that Browser.
Also, if the above method can't work, can anyone please give me some tips on alternatives of how to accomplish this?
Thanks
No, that's exactly what I mean, THERE IS NO DEFAULT browser because there is no default window environment. KDE's way of selecting the 'default' browser is different to gnome's way of doing it, is different to fluxbox's way...etc...hence it isn't possible to detect the user's 'default' browser because the method would be different if the user uses gnome to if they use kde or xfce or....
 
Old 09-30-2005, 11:39 AM   #8
Last Attacker
Member
 
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120

Original Poster
Rep: Reputation: 15
Ok, but lets say that I'm in KDE, will it open up in conquerer or if in Gnome, in whatever browser gnome uses.
Thats actually what I meant, sorry.
But ok, if its not possible, do you have an idea of how it can be done?
 
Old 10-01-2005, 07:27 AM   #9
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 54
Quote:
Originally posted by Last Attacker
Ok, but lets say that I'm in KDE, will it open up in conquerer or if in Gnome, in whatever browser gnome uses.
Thats actually what I meant, sorry.
But ok, if its not possible, do you have an idea of how it can be done?
But that's it...you can't just say "open default browser" you'd have to first call some gnome or kde function to open the default browser, probably using some function from either the kde or gnome library.
 
Old 10-01-2005, 09:08 PM   #10
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 31
Quote:
Originally posted by Komakino
But that's it...you can't just say "open default browser" you'd have to first call some gnome or kde function to open the default browser, probably using some function from either the kde or gnome library.
Isn't that saying the same thing?

At any rate, in KDE can just say "open this file in the default application." You can do it from the command line like so:
Code:
kfmclient exec /path/to/file
This will basically run the file as if you had double-clicked on it in Konqueror, opening it in the default handler for its MIME type. Not exactly the same as the "default web browser" concept from Windows, but close enough.
 
Old 10-20-2005, 01:32 PM   #11
froidnoid
LQ Newbie
 
Registered: Oct 2005
Location: The Far Far West
Distribution: SuSE 9.*, Ubantu
Posts: 4

Rep: Reputation: 0
Quote:
Originally posted by AdaHacker
Isn't that saying the same thing?

At any rate, in KDE can just say "open this file in the default application." You can do it from the command line like so:
Code:
kfmclient exec /path/to/file
This will basically run the file as if you had double-clicked on it in Konqueror, opening it in the default handler for its MIME type. Not exactly the same as the "default web browser" concept from Windows, but close enough.
Does anybody know how to do this with Gnome (or any other UI framework)?
I got the KDE one to work, but I need to be able to find a way to do this on more distributions then just the ones that use KDE.

Thanks for any hints
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default File Browser TwiztedTom Linux - Software 2 05-12-2005 05:23 AM
firefox default browser, opening html pages in new window perfect_circle LinuxQuestions.org Member Success Stories 3 03-29-2005 11:26 AM
File browser wont open. allforcarrie Mandriva 11 11-15-2004 03:29 AM
FC2: Default browser doesn't open page Wopke Linux - Software 0 06-21-2004 05:04 PM
How to make Mozilla Firefox my default file browser? jato Linux - Software 2 03-30-2004 12:33 PM


All times are GMT -5. The time now is 11:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration