Headers Required:
#include <apgtask.h> #include <apgcli.h>
Library Needed:
LIBRARY apgrfx.lib
Source:
// ---------------------------------------------------- // CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl) // Used for launching the default browser with provided url. // ---------------------------------------------------- // void CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl) { const TInt KWmlBrowserUid = 0x10008D39; TUid id( TUid::Uid( KWmlBrowserUid ) ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param = HBufC8::NewLC( aUrl.Length() + 2); //"4 " is to Start/Continue the browser specifying a URL param->Des().Append(_L("4 ")); param->Des().Append(aUrl); task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used CleanupStack::PopAndDestroy(param); } else { HBufC16* param = HBufC16::NewLC( aUrl.Length() + 2); //"4 " is to Start/Continue the browser specifying a URL param->Des().Append(_L("4 ")); param->Des().Append(aUrl); RApaLsSession appArcSession; // connect to AppArc server User::LeaveIfError(appArcSession.Connect()); TThreadId id; appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid) , id ); appArcSession.Close(); CleanupStack::PopAndDestroy(param); } }
Additional information about the parameters that are passed as command line arguments when launching the Browser:
1. Start/Continue the browser and nothing is specified (the default case)
Parameter = <Any text>
2. Start/Continue the browser specifying a Bookmark
Parameter = 1+<Space>+<Uid of the Bookmark>
3. Start/Continue the browser specifying a Saved deck
Parameter = 2+<Space>+<Uid of the Saved deck>
4. Start/Continue the browser specifying a URL
Parameter = 4+ <Space>+<Url>
5. Start/Continue the browser specifying a URL and an Access Point
Parameter = 4+<Space>+<Url>+<Space>+<Uid of Ap>
6. Start/Continue the browser with the start page. (Used when starting the browser with a long press of 0 in the Idle state of the phone.
Parameter = 5
7. Start/Continue the browser specifying a Bookmark folder
Parameter = 6+ <Space>+<Uid of the Folder>