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

Reply
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Device: Z10

windows.location: invalid url

Hi,

 

in one application I wanted to open a url and passing username and password for normal http authentification. For example:

 

function init() {

        window.location = "https://user:password@mydomain.org/mobile/";
}

 In the browser its working fine, but as a webworks application I get an "Invald Url". Any recommendations to solve this in a different way?



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: windows.location: invalid url

Is this for the Smartphone SDK?  if so, the problem is the underlying BrowerField J2ME object does interpret the URL correctly as the browser.  

 

Its very important to recognize that  BrowserField != browser

 

The only thing in common between these two should be the rendering engine they share - how page content is displayed.  The functionality & interaction of content such as links / caching / etc. are separate, and it is often in these places that we see a disconnect between behavior of the browser and a WebWorks app:

 

A clean solution doesn't jump to mind, unfortunately.  What I could suggest is using XmlHttpRequest to send an asyncronous request to mydomain.org, providing the credentials as part of the xhr.open() .  That might allow your webserver to receive a regular HTTP request like this:

 

window.location = "https://mydomain.org/mobile/";

because you have already authenticated with the server?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.