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

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T

Re: Basic XMLHttpRequest sample requesting a CSV

I am getting whole login page content from server and used "window.open();" to load it on webview. Now I need "urlChanged" event or some other way to identify when new url is loading on webview.

 

please find my code bellow:

            function ready() {
                var xmlhttp = new XMLHttpRequest();
                    xmlhttp.onreadystatechange = function () {
                         if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                                     childWindow = window.open("data:text/html,"+unescape( encodeURIComponent( xmlhttp.responseText ) ),"_self");     


                    }
                };
                xmlhttp.open("POST",url, true);
                xmlhttp.send(getRequestBody());
            }

 

NOTE: I want to implement setInterval() to handle urlChanged on webview but it is not firing after page is loaded on webview. could you give me an example to achieve it.

 

 

 

Thanks,

Shwarup Biswas
Highlighted
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Basic XMLHttpRequest sample requesting a CSV

When you say webview, do you mean the native/Cascades component?


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
Posts: 93
Registered: ‎08-18-2011
My Device: 9550
My Carrier: At&T

Re: Basic XMLHttpRequest sample requesting a CSV

Not native/Cascades component. I am talking about ChildBrowser.

Thanks,

Shwarup Biswas
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Basic XMLHttpRequest sample requesting a CSV

Ah, that clears it up. So you can't specifically add an event listener, however the samples we use leverage a setInterval that retrieves the current URL and compares it against the desired value periodically. You can see the implementation here:

https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/FaceBook-OAuth-2/js/app.js#L70


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.