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 Contributor
Posts: 6
Registered: ‎06-04-2013
My Device: Pearl 9105
My Carrier: Telkomsel
Accepted Solution

How to cross domain (external url) and what <access> tag is correct?

How to cross-domain?
I have edited some of the access element tag ( <access> )
https://developer.blackberry.com/html5/documentation/accessing_external_resources_webworks.html

 

I've changed some of the access elements such as:

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

<access uri ="*"/> ;
<access uri ="http://blablabla.com" subdomains="true"></access>


but still I can not open the external url.
This is the error message from my blackberry device:

 

The resource - http://www.blabla.com/ - could not be retrieved because it was not found in the config.xml
Please verify the <access> elements bla.. blaa..

 

* I used phonegap build from phonegap library for blackberry,  and succes to install it via the QR Code.

I run the app and running fine, but when i click the links to external domain (url), I get an error message.

 

Thanx in advance Smiley Happy

BlackBerry Development Advisor
Posts: 761
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: How to cross domain (external url) and what <access> tag is correct?

Would you mind pasting your whole config.xml?

New Contributor
Posts: 6
Registered: ‎06-04-2013
My Device: Pearl 9105
My Carrier: Telkomsel

Re: How to cross domain (external url) and what <access> tag is correct?

Hi chadtatro,

 

I modified the original code from phonegab bb lib  > to be simpler because i don't need API.

I just need a simple html example can run on my blackberry device and also can open the website from external url

 

This is my config.xml source:

 

<?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.0" id="org.apache.cordova.example">

  <name>TestApp</name>
  <author>James Bond</author>
  <description>
       A sample Apache Cordova application that responds to the deviceready event.
  </description>

  <access uri="http://www.google.com" subdomains="true"></access>

  <icon rim:hover="false" src="res/icon/blackberry/icon-80.png" />
  <icon rim:hover="true" src="res/icon/blackberry/icon-80.png" />

  <rim:loadingScreen backgroundColor="#CFCFCF" foregroundImage="res/screen/blackberry/screen-225.png" onFirstLaunch="true">
    <rim:transitionEffect type="fadeOut" />
  </rim:loadingScreen>

  <content src="index.html" />

</widget>

 

 

 

And this is my html source:

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <div style="font-size: 16px;font-weight: bold;line-height: 2.0em;text-decoration: none;">
              <a href="http://www.google.com">Google</a>
            </div>
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>
        </div>
        <script src="phonegap.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

 

please help

 

thanx Chad Smiley Happy

BlackBerry Development Advisor
Posts: 761
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: How to cross domain (external url) and what <access> tag is correct?

Oh I see...

 

Check-out my sample app in that case:  https://github.com/blackberry/Cordova-Samples/tree/master/BB10-Bootstrap

 

 

New Contributor
Posts: 6
Registered: ‎06-04-2013
My Device: Pearl 9105
My Carrier: Telkomsel

Re: How to cross domain (external url) and what <access> tag is correct?

Hi Chat,

 

Is your sample app is compiled through phonegap build as like i did?

 

Reason I'd compile through phonegap because I do not need to download > set up the SDK, simulator or whatever.

I don't need API, i don't need Responsive design using jquery mobile, bootstrap or whatever.

This time I just want to try a simple html 5 could open external link. That's it.

 

I always get an error message on my device after installed n run the app:

change www.blackberry.com to www.blabla.com

 

 

Once again

This is my simple config xml:

<?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.0">
  <name>TestApp</name>
  <description>
    A sample application to demonstrate some features.
  </description>
  <access uri="http://www.blabla.com" subdomains="true"/>
  <icon src="icon.png"/>
  <content src="index.html"/>
</widget>

 

 

and this is my simple html:

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello World Whats Up</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
</head>

<body>
<center>
  <div style="font-size: 16px;font-weight: bold;color: #003399;line-height: 3.0em;">
    <a href="hello_world.htm">Test Local Page</a> < I can open this local link.<br>
    <a href="http://www.blabla.com">blabla.com</a> < I can not open this external link.
  </div>
</center>
</body>
</html>

 

 

Thanx

Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: How to cross domain (external url) and what <access> tag is correct?

This is always annoying

 

You need something called CORS from the remote

 

This involves inserting a header

 

You can find out the why + wherefore @ http://en.wikipedia.org/wiki/Cross-origin_resource_sharing and there's a very good guide as to how to configure a server @ http://enable-cors.org

 

I use CORS headers in everything I do these days and have not had any issues for several years

 

You can even get it working in Chome - and thereby Ripple




Click the like button if you find my posts useful!
Developer
Posts: 19
Registered: ‎10-05-2012
My Device: Blackberry Dev Alpha C, Blackberry Z10 LE, Blackberry PlayBook
My Carrier: Vodafone

Re: How to cross domain (external url) and what <access> tag is correct?

The problem with mine was that I needed so disable the websecurity part inside my config file.

 

This is the code I used for it, after that I could retrieve the information/page I wanted.

 

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

Please click the like button if my post helped you! Thank you.
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel

Re: How to cross domain (external url) and what <access> tag is correct?

@pandrini, where u able to solve the problem which u originally had? or u still need help?
--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Developer
Posts: 19
Registered: ‎10-05-2012
My Device: Blackberry Dev Alpha C, Blackberry Z10 LE, Blackberry PlayBook
My Carrier: Vodafone

Re: How to cross domain (external url) and what <access> tag is correct?

@lathajagan, my problem is already solved with the lines of code I posted. It was solved with help from the devs of BlackBerry.
Please click the like button if my post helped you! Thank you.
New Contributor
Posts: 6
Registered: ‎06-04-2013
My Device: Pearl 9105
My Carrier: Telkomsel

Re: How to cross domain (external url) and what <access> tag is correct?

Hi Padrini,

 

Thanx for your help.

 

I still get the same error Smiley Sad

 

FYI:

I use OS 7 or earlier, 

param element that you write above, only applies to BlackBerry 10 OS.

 

https://developer.blackberry.com/html5/documentation/param_element.html

 

Anyway, thanks for your help

 

 

Regards