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
New Contributor
dominaria
Posts: 2
Registered: ‎01-19-2013
My Device: Dev Alpha
My Carrier: .
Accepted Solution

Access to local network IP is not allowed

Hello,

 

I am trying to make an Ajax call to a local netowork IP over Wi-Fi on a different port than 80..  When executed on an actual device, I always get "Access to XYZ is not allowed" where XYZ is the URL of my attempt.

 

The app is intended to be a management app for a hardware box from a certain manufacturer that the user has on their home network. The online 'cloud' service API tells the app what the local IP of the box is, then the app attempts to make API calls against the unit on that IP.

 

Example call: http://192.168.2.15:1234/api_call_here

 

In config.xml I have tried many things, including:

 

  <access uri="*" />

 

...and ...

 

  <access uri="http://192.168.2.15:1234" /> (which wouldn't work for me in production, since I'll never know the local IP before hand)

 

...but nothing seems to allow the connection to another local network IP. WebInspector shows that the connection was blocked by NativeCode:1.

 

Can it be done?  Or this this somehow blocked by the framework?

 

Thanks,

 

dom

 

Please use plain text.
BlackBerry Development Advisor
bryanhiggins
Posts: 201
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: Access to local network IP is not allowed

Global whitelisting for XHR is not currently supported.

 

For your scenario to work, you will need to disable web security.

 

<feature id="blackberry.app" >
        <param name="websecurity" value="disable" />
</feature>
Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Please use plain text.
New Contributor
dominaria
Posts: 2
Registered: ‎01-19-2013
My Device: Dev Alpha
My Carrier: .

Re: Access to local network IP is not allowed

Brilliant, thanks Bryan!

 

dom

Please use plain text.