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
Highlighted
New Developer
Posts: 8
Registered: ‎08-29-2013
My Device: Q10
My Carrier: Rogers
Accepted Solution

XHR woes... disable websecurity, or other options (ie, WebSocket)??

Hi experts.

 

I need to do AJAX (XHR) request in my app, but I am unable to whitelist the server(s) becasues the servers are set by the user at run-time (GPS-reporting app that can communicate to any given server, based on user settings).

 

This was once suggested to me a while back (add to config.xml), do disable AJAX whitelist / blacklist:

 

<feature id="blackberry.app">
    <param name="websecurity" value="disable" />
</feature>

 

My questions are:

  1. Is the above workaround still supported in WebWorks 2.1?
  2. If yes, will I be allowed to use the workaround for a completed app (ie, would my app submission get rejected because of this)?
  3. Are there any other methods to communicate to the server (asynchronously) other than AJAX that come to mind  (ie, WebSocket)?
  4. Is WebSocket supported in WebWorks 2.1??   I saw documentation on WebWorks 1.0 that WebSockets support was there, but I could not find any reference in WebWorks 2.1 docs.

I realize I could run a proxy at a fixed address to overcome this, but I would rather use this as a VERY last resort.

 

Thanks very much,


Ray

Retired
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: XHR woes... disable websecurity, or other options (ie, WebSocket)??

Hi,

 

You can disable websecurity in WebWorks 2.1, but the syntax is slightly different:

 

<platform name="blackberry10">
    <preference name="WebSecurity" value="disable" />
</platform>

 

It will be allowed in a completed app. The onus is on you to ensure that you aren't mixing in untrusted content.

 

WebSocket is supported but it has the same cross origin limiations as XHR.

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
New Developer
Posts: 8
Registered: ‎08-29-2013
My Device: Q10
My Carrier: Rogers

Re: XHR woes... disable websecurity, or other options (ie, WebSocket)??

Thanks very much Bryan... I appreciate the reply. I discovered the slightly modified syntax for WebWorks 2.1 the other day, but I am glad to hear your confirmation that it is allowed in a completed app.

Regards,

Ray