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
Contributor
Posts: 28
Registered: ‎02-14-2012
My Device: developer
Accepted Solution

javascript alert access to <url> not allowed

[ Edited ]

I'm getting this error and don't understand why I get it because I think I put in the access parameter into my config.xml properly.  Here's the relevant section of the config.xml file:

================

  <rim:smileytongue:ermissions>
    <rim:smileytongue:ermit>access_shared</rim:smileytongue:ermit>
  </rim:smileytongue:ermissions>
 
  <access url="cdn.sencha.com" subdomains="true"></access>
 
  <icon src="icons/icon-86.png"/>
  <icon src="icons/icon-150.png"/>
 
  <content src="app.html"/>
================

 

There seem to be a lot of posts mentioning this:

 

http://www.sencha.com/forum/showthread.php?268724-Access-to-quot-cdn.sencha.com-...-sencha-touch.css...

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/JavaScript-Alert-URL-not-allowed...

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/JS-Popup-Access-to-URL-Not-Allow...

 

 

Here's what the error looks like:

BB10CDNError.JPG

 

 

FYI, making it look like this didn't work either :-P

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

  <rim:smileytongue:ermissions>
    <rim:smileytongue:ermit>access_shared</rim:smileytongue:ermit>
  </rim:smileytongue:ermissions>
 
  <access url="cdn.sencha.com" subdomains="true" />
 
  <icon src="icons/icon-86.png"/>
  <icon src="icons/icon-150.png"/>
 
  <content src="app.html"/>
 
  <feature id="blackberry.ui.dialog"/>

 

BlackBerry Development Advisor
Posts: 624
Registered: ‎10-01-2009
My Device: Z10

Re: JavaScript alert access to <url> not allowed

Using this (in my own samples) works for sure, although I haven't been able to try on the simulator.

 

<access uri="*" subdomains="true"></access>
<feature id="blackberry.app">
   <param name="websecurity" value="disable" />
</feature>

 

Could you paste your whole config.xml, and use the code formatting button in the post options so that we can clearly read the text without smiley faces appearing :smileytongue:

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Contributor
Posts: 28
Registered: ‎02-14-2012
My Device: developer

Re: JavaScript alert access to <url> not allowed

What? You don't like smiley faces?? :catvery-happy:

 

I don't have a BB device to test on...trying to get this Sencha Architect app working for that promo.  Sencha Architect doesn't seem to support device orientation changes in their UI so this is going to be a pain too :smileyindifferent:

 

Here's the full config file:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0" id="com.pvs.jrx">
 
  <author href="http://www.pixvision.com/"
          rim:copyright="(c)Copyright 2013">Ken</author>
 
  <name>App Name</name>
 
  <description>
    my app
  </description>

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

  <rim:permissions>
    <rim:permit>access_shared</rim:permit>
  </rim:permissions>
  
  <access url="cdn.sencha.com" subdomains="true" />
 
  <icon src="icons/icon-86.png"/>
  <icon src="icons/icon-150.png"/>
 
  <content src="app.html"/>
 
  <feature id="blackberry.ui.dialog"/>
   
  <feature id="blackberry.app">
    <param name="orientation" value="portrait" />
    <param name="backgroundColor" value="0xFFFF0000" />
  </feature>
 
  <license href="http://www.pixvision.com/"/>
 
</widget>

 

Contributor
Posts: 28
Registered: ‎02-14-2012
My Device: developer

Re: JavaScript alert access to <url> not allowed

BTW, the Ant build script does warn that web security is disabled, so the tag apparently is correct:

 

     [exec] [BUILD]   Populating application source
     [exec] [BUILD]   Parsing config.xml
     [exec] [WARN]    You have disabled all web security in this WebWorks application
     [exec] [BUILD]   Generating output files
     [exec] [WARN]    Failed to find debug token

 

The build.bb10.prod target doesn't warn about the debug token but both versions behave the same way.

 

 

Contributor
Posts: 28
Registered: ‎02-14-2012
My Device: developer

Re: JavaScript alert access to <url> not allowed

FYI, I uploaded the app to BB World and saved it in Draft mode if you want to download and try it (I'm assuming BB folks can go grab .bar files in Draft mode which we can't do).

 

Also put a posting up on the Sencha/BB10 forum but no one has heard of this issue there either apparently or no one uses the simulator :-P

 

Contributor
Posts: 28
Registered: ‎02-14-2012
My Device: developer

Naveen found the issue

[ Edited ]

I posted this on the Sencha forums as well.

 

The issue was that this isn't a URI (I thought specifying it this way would automatically get the SSL and non-SSL URLs):

<access url="cdn.sencha.com" subdomains="true" />

 

This works:

  <access uri="*" subdomains="true" />

 

And this also works:

 

  <access uri="http://cdn.sencha.com" subdomains="true"/>
  <access uri="https://cdn.sencha.com" subdomains="true"/>

 

 

But still odd that this super override doesn't do anything...you'd think it would help:

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

 

BlackBerry Development Advisor
Posts: 624
Registered: ‎10-01-2009
My Device: Z10

Re: Naveen found the issue

Ahh right, right.... Very easy thing to overlook. Thanks for posting an update :smileyhappy:
Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro