Launching the web browser on 3rd Edition to open a specified URL

http://wiki.forum.nokia.com/index.php/TSS000340_-_Launching_the_Web_browser_on_S60_3rd_Edition_to_open_a_specified_URL

 

Overview

Launching the Web browser on S60 3rd Edition to open a specified URL

Description

In order to launch the Web browser on S60 3rd Edition and have it automatically open a specified URL, the application must have the SWEvent capability. Note that the UID of the OSS browser in S60 3rd Edition is 0x1020724D and from S60 3rd Edition, FP1 onwards 0x10008D39.

Reference code:
RApaLsSession apaLsSession;
const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
HBufC* param = HBufC::NewLC(64);
param->Des().Copy(_L("4 http://www.yahoo.com/"));
TUid id(KOSSBrowserUidValue);
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(id);
if(task.Exists())
    {
    task.BringToForeground();
    HBufC8* param8 = HBufC8::NewLC(param->Length());
    param8->Des().Append(*param);
    task.SendMessage(TUid::Uid(0), *param8); // UID not used
    CleanupStack::PopAndDestroy(param8);
    }
else
    {
    if(!apaLsSession.Handle())
      {
      User::LeaveIfError(apaLsSession.Connect());
      }
    TThreadId thread;
    User::LeaveIfError(apaLsSession.StartDocument(*param, KOSSBrowserUidValue, thread));
    apaLsSession.Close();   
    }
CleanupStack::PopAndDestroy(param);
Note: If the browser is currently in the process of loading an URL and an external application tries to open another one, the error "Unable to retrieve" is shown and the new URL is not loaded.
See also topic TSS000551 - Different browser UIDs in S60 3rd Edition and S60 3rd Edition, FP1.

Here is some additional information about the parameters that are passed as command line arguments when launching the OSS 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>”

Browser Launcher API

The SDK API Plugin package for S60 3rd Edition SDKs includes the Browser Launcher API.

CBrowserLauncher

class will automatically determine which browser to launch.

Parameters passed to this API are in the same format as above:

 

<nowiki>
&nbsp;&nbsp;CBrowserLauncher* launcher = CBrowserLauncher::NewLC();
&nbsp;&nbsp;launcher->LaunchBrowserEmbeddedL(_L("4 http://www.nokia.com"));
&nbsp;&nbsp;CleanupStack::PopAndDestroy(launcher);
</nowiki>


Retrieved from " http://wiki.forum.nokia.com/index.php/TSS000340_-_Launching_the_Web_browser_on_S60_3rd_Edition_to_open_a_specified_URL"

你可能感兴趣的:(Web,application,url,Parameters,browser,reference)