prabhakaran
prabhakaran

Reputation: 5274

Qt - How to open a website in a particular browser

I am coding one project, which needs to launch some webbrowsers with the given url.

I saw some QT examples, but they explained how to launch the default browser, not a particular browser.

Any helping suggestions will be appreciated.

Edit1:

Below is the code I use currently

QString temp="C:/Program Files/Internet Explorer/iexplore.exe";
process->start(temp.toStdString().c_str());

Edit2

Hi, I found that the problem is not in QProcess->start, Because it works perfectly for "explorer.exe", But not works, for executables which are in Program Files. So I post a new question about it.

Upvotes: 1

Views: 2841

Answers (2)

Ben Voigt
Ben Voigt

Reputation: 283634

system("/path/to/the/browser \"http://www.the.com/url\"");

or spawn instead of system (gives you control over environment variables, etc.)

Upvotes: 2

g19fanatic
g19fanatic

Reputation: 10931

If you know which browser you want to start and where they are located on the system (such as the default installation directories). You should be able to use QProcess

This can usually be done as the following:

iexplore.exe http://www.locationOfUrl.com

or

//path/to/app/firefox.exe http://www.locationOfUrl.com

Upvotes: 3

Related Questions