Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
Accepted Solution

New tabs not opening in webview

Hi, i used a webview to initiate login to facebook. The initial page appears with a login button in it. When it is clicked, it should actually open a new window(or a new tab), but it doesn't even appear in the current page in the webview. Any idea what might be wrong?

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: New tabs not opening in webview

It could be any number of things with the very little infotrmation you have provided.

Post the code you currently have and someone will look at it I'm sure.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: New tabs not opening in webview

QVariantMap map;
map["initial-scale"] = 2.0;

 

QUrl settingsPageUrl = QUrl("http://connectapp.hostoi.com/index.html");

 

settingsWebpage = new WebView;
settingsWebpage->settings()->setViewportArguments(map);
settingsWebpage->setUrl(settingsPageUrl);

 

 

settingsPage->setContent(settingsWebpage);

navPane->push(settingsPage);

 

This results in my page being loaded, with a login button in it. But when I click on the button, it simply disappears and nothing else happens. Actually, what happens is the login page appears in a popup. But in simply doesn't load in awebview. What's wrong?

BlackBerry Development Advisor
Kareem_ELSayed
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10

Re: New tabs not opening in webview

Hi SuhairZain,

 

I can't re-produce this problem. I've tested your URL using both QML/C++: code below and i get Facebook login page loaded in the Webview. (I've tested it using BB N SDK 10.1).

 

I've noticed that the page takes a few seconds to load.  

 

WebView {
                    id: webView
                    objectName: "webView"
                    url: "http://connectapp.hostoi.com/index.html"
                    settings.viewport: { "initial-scale" : 2.0 }
                    settings.zoomToFitEnabled: true
                    settings.activeTextEnabled: true
}

 

        // Create root object for the UI
        AbstractPane *root = qml->createRootObject<AbstractPane>();

	QVariantMap map;
	map["initial-scale"] = 2.0;
	QUrl settingsPageUrl = QUrl("http://connectapp.hostoi.com/index.html");
	WebView *settingsWebpage = root->findChild<WebView*>("webView");
	settingsWebpage->setUrl(settingsPageUrl);
	settingsWebpage->settings()->setViewportArguments(map);

 if you still facing the issue, please advice on the SDK version you are using? Which device OS / simulator version tested on? 

 

Thanks,

Kareem.

 

Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: New tabs not opening in webview

It's working now, though as you said, there is a delay in loading pages, any idea what might be wrong?
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: New tabs not opening in webview

Do you think that such a delay is normal in login pages?
BlackBerry Development Advisor
Kareem_ELSayed
Posts: 81
Registered: ‎09-09-2013
My Device: BlackBerry Z10

Re: New tabs not opening in webview

Hi Suhair,

I don't think it's the login page, but it might be the WebView however, at the end the performance is not bad, I recommend to use activity bar attached to the webview so the end-user knows that something is happening.

Thanks,
Kareem.
Kareem ELSayed | Application Development Consultant | Developer Relations | BlackBerry | Twitter:@kemobyte
Developer
SuhairZain
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B

Re: New tabs not opening in webview

i have already set a progress indicator and it works fine..  thnx buddy..