Resolving link with Browser Control API

Login to reply to this topic.
Tue, 2007-06-05 11:56
Joined: 2006-10-17
Forum posts: 85
Hi,

I'm using browser control api to load web pages in my app, but I'd like to be able to click on page's link and surf the page. Should I implement MBrCtlLinkResolver interface?

Thanks a lot

Tue, 2007-06-12 17:29
Joined: 2006-10-17
Forum posts: 85
Re: Resolving link with Browser Control API
I've implemented MBrCtlLinkResolver interface, but when I click on a link nothing succeed
Code:
void CMyContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
iLayoutObserver = CBrCtlSampleAppLayoutObserver::NewL(this);
iLinkResolver = new CBrCtlSampleAppLinkResolver(this);
iCommandBase = TBrCtlDefs::ECommandIdBase;
iBrCtlCapabilities = TBrCtlDefs::ECapabilityLoadHttpFw | TBrCtlDefs::ECapabilityDisplayScrollBar |TBrCtlDefs::ECapabilityClientNotifyURL | TBrCtlDefs::ECapabilityClientResolveEmbeddedURL;
TRect rect(Position(), Size());
iBrCtlInterface = CreateBrowserControlL( this, aRect, iBrCtlCapabilities, iCommandBase, NULL, iLinkResolver, NULL, iLayoutObserver, NULL);
iBrCtlInterface->ActivateL();
_LIT(KUrl, "http://www.yahoo.com/");
iBrCtlInterface->LoadUrlL(KUrl, -1, TBrCtlDefs::ECacheModeNoCache);
}

TBool CBrCtlLinkResolver::ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl, MBrCtlLinkContent& aBrCtlLinkContent)
    {
     iMyContainer->UpdatePage(aUrl);
     }

void CMyContainer::UpdatePage(const TDesC& aUrl)
    { 
    iBrCtlInterface->LoadUrlL(aUrl, -1, TBrCtlDefs::ECacheModeNoCache);
    }

I've also implemented MBrCtlLayoutObserver interface like in the browser control api guide, where a text should be drawn when functions' callback are called. I see that this string text is drawn for a second during the web page loading, but it disappears at once. Then when the page is loaded if I moove the mouse nothing succeeds

If you could please suggest to me where I have a leak....

Thank you very much
Thu, 2007-06-14 14:56
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: Resolving link with Browser Control API
I found that iLinkResolver is type of CBrCtlSampleAppLinkResolver, whilst you've implemented ResolveLinkL method as part of CBrCtlLinkResolver class. You see? CBrCtlSampleAppLinkResolver != CBrCtlLinkResolver. Can it be the source of the problem?

As to MBrCtlLayoutObserver interface: why do you expect that anything should happen when you move the mouse? This interface is not about letting you know if the mouse is moving, but about scrolling, layout changes (left-to-right or vice versa) or updating the title.

Tote

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2007-06-14 17:16
Joined: 2006-10-17
Forum posts: 85
Re: Resolving link with Browser Control API
Hi Tote,

I've implemented ResolveLinkL method as part of CBrCtlSampleAppLinkResolver, I was wrong writing here.
Could be some TBrCtlDefs capabilities leak? Anyway I seem to use all required ones.

How should I implement to scroll the page like it was loaded in in Nokia Web Browser? I wish to could move from a link to another mooving my device mouse. I can capture mouse event like this:
Code:
TKeyResponse CMyContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
    {
    if (aKeyEvent.iCode == EKeyDownArrow)
    {
    CAknInformationNote* info = new   
            CAknInformationNote();
    info->ExecuteLD(_L("down"));
    }
    }
Should I exploit OfferKeyEventL function for my purpose?

Thank you very much for any clue!!!

Bye, Luca
Thu, 2007-06-14 21:31
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: Resolving link with Browser Control API
So what does exactly happen when a link is being activated? Does your ResolveLinkL get called? What about HandleResolveComplete and HandleResolveError? What happens at all?

Btw, why do you want to override the default behavior? What is your purpose, extra requirement? Do you want to entirely replace the default behavior with your new one or just do something in addition to that?

Tote

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2007-06-14 21:32
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: Resolving link with Browser Control API
Btw, you can easily rule out missing capabilities: assign each and every capability to your control and see what happens.

And no, I don't think you should override OfferKeyEventL - that's already taken care of by the default implementation inside Browser Control. You CAN do it, though, if you wish, but then please don't forget to call the base class' implementation at some point in your code.

Cheers,

Tote

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Fri, 2007-06-15 10:01
Joined: 2006-10-17
Forum posts: 85
Re: Resolving link with Browser Control API
when I try to click a link nothing happens, ResolveLinkL isn't called.
Is it right implementing  MBrCtlLinkResolver and MBrCtlLayoutObserver interfaces to resolve links of a loaded web pages and to scroll it (moove from a link to another with mouse)?
If you can, could you please mail to me (luca.priano@alice.it) a sample code about this, so I can understand the issue, because I'm on the horns of a dilemma Huh

Thank you for your availability,
cheers, Luca.
Fri, 2007-06-15 15:00
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Re: Resolving link with Browser Control API
Hi,

First of all, I don't have any working sample that I could provide to you. I just know something about BrCtl how it works.

Secondly, please notice that the layout observer is not for making scrolling, but for being notified about the page being scrolled. It's not the same.

And third, I'm very surprised to read that your ResolveLinkL method didn't get called. It should have been called. I am at my wits' end, too.  Undecided

Tote

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2007-09-13 08:30
Joined: 2007-06-21
Forum posts: 82
Re: Resolving link with Browser Control API

If you are working on S60 3rd edition, there is a bug in Web browser.....
ResolveLink callback is never made, even if you implement observer and have all the capabilities.
I'm also trying to figure out, how to avoid this problem. I'm planning to capture mouse event and then check for the link presses(a kind of hack only for S60 3rd edition).
On FP1, everything works. I found this out by seeing the source code of S60 Webkit(opensource.nokia.com). In S60 3rd edition, webkit doesn't check for the "TBrCtlDefs::ECapabilityClientNotifyURL" and never makes call to ResolveLinkL.
I also found this bug here:
http://lists.macosforge.org/pipermail/webkit-unassigned/2006-June/012652.html

HTH
Gurpreet
www.mobisy.com

Wed, 2007-09-19 17:38
Joined: 2006-10-17
Forum posts: 85
Re: Resolving link with Browser Control API

...so it's ok

TKeyResponse CMyContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
    {
	 if (iBrCtlInterface)
        {
        return iBrCtlInterface->OfferKeyEventL(aKeyEvent, aType);
        }
    return EKeyWasConsumed;	
    }

bye

  • Login to reply to this topic.