BrowserOpen

From TrillWiki

Jump to: navigation, search

The browserOpen function opens up a particular url using the default browser associated with a particular protocol.

Compatibility: 2.0 and higher

Contents

Syntax

plugin_send(MYGUID, "browserOpen", struct browser_location_t *);

Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.

Parameters

BrowserOpen utilitizes the browser_location_t structure.

struct browser_location_t {  
 	unsigned int			struct_size; 
 
 	char				*location; 
 
 	int				new_window; 
 	int				check_security; 
 };


location
The URL to load up. This can be like "http://www.google.com" or "custom_protocol://sample"
new_window
For http based url's, Trillian supports opening up new browser windows for some browsers. Set this to 1 to open up a new browser (and not reuse an existing window). Set this to -1 if you wish to use the default setting from Trillian's preferences.
check_security
Set this to 1 if you want Trillian to check what protocol will be used for the particular URL. Trillian will automatically allow http to go through, however other protocols Trillian will first notify the user which program to use.


Return Value

Negative value on error, 0 on success.

Remarks

Trillian allows plugins to register as default browsers for particular protocols (such as http). It is good to always use this function instead of detecting the system's default browser so that the url is opened on the correct program.


Personal tools