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
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

How to extract params from request.url via Javascript?

I have webview with some url like https://oauth.someserver.com after sending request I have redirect to another location like : https://oauth.someserver.com/token.html#access_token=475437hfdjghrt37grh&something_else=3252626

 

I know how to get this (using request.url), but I can't extract params using JavaScript, because JS split method don't work and other methods don't work too.

 

 

how I can receive params from requested url via JS?

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to extract params from request.url via Javascript?

Can you post the javascript that attempted to split?

 

What are the "other methods"?   Did you try a C++ function?

 

Stuart

Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: How to extract params from request.url via Javascript?

something like:

 

Page {
    ScrollView {
        Container {
            background: Color.create ("#f8f8f8")
            layout: StackLayout {
                layoutDirection: LayoutDirection.TopToBottom
            }
            WebView {
                url: "http://developer.blackberry.com"

               onNavigationRequested: {
                     var myurl = request.url;
                     var myresult = myurl.split('&');
                     // after deploying in debug console wroted like "can't find method split and etc (I can't try this error now)
               }
            }
        }
    }
}

 

Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: How to extract params from request.url via Javascript?

Highlighted
Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: How to extract params from request.url via Javascript?

Hi,

 

I believe you would have to split this yourself - there must be many libraries online that can show you how to do this or perform the split for you;

 

Martin