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
Posts: 7
Registered: ‎03-28-2013
My Device: CURVE
My Carrier: ATT
Accepted Solution

How do you open a single page within BB10 Webworks build?

Hi all,

 

Got a web app compiled for 6 different device types and came accross an issue causing the BlackBerry 10 Vendor submission review to be denied because of a blank window.  The webworks web app successfully finds index.html and the code is as follows:

 

<html>
    <head>      
        <meta http-equiv="Content-Type" content="text/html; 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>Profile Search</title>
		<script src="local:///chrome/webworks.js" type="text/javascript"></script>
        <script type="text/javascript" src="js/index.js"></script>
		<script type="text/javascript" src="js/jquery15.min.js"></script>
        <script type="text/javascript">
		var authUrl = "http://thegovsite.org/dev/bb.nsf/m_confirm.xsp";
		function ready() {
				window.open(authUrl,'_self');
				//do more stuff here some day..
				}
		window.addEventListener("load", function(e) {
					 document.addEventListener("webworksready", ready);
				  }, false);
        
        </script>
    </head>
    
</html>

 However window.open(authUrl,'_self');  loads the page in a new "window" outside the app frame.  I've also tried window.location = authUrl, window.location.href = AuthUrl, etc.   It seems that instead of loading the external URL in the same frame, it is using the invoke method instead which is the opposite of what needs to happen.

 

Any ideas to get page loaded in same instance like OS7 and lower, Android, iOS, etc.?

 

Thanks in advance!

Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: How do you open a single page within BB10 Webworks build?

If you want to replace the content of your page, why not load the html in a div via AJAX?
Another solution is to load the page in an iframe.
--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
New Contributor
Posts: 7
Registered: ‎03-28-2013
My Device: CURVE
My Carrier: ATT

Re: How do you open a single page within BB10 Webworks build?

Hi Olivier,

 

I tried pulling the data via ajax, and pasting over a div I put onto the index.html page while also having:

 

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

within the config.xml file.  When doing so, the device goes to refresh the page in the same window as expected, but then it throws device alerts that getting the javascript files from the server is not allowed????  

 

"Access to 'http://server.host.org/xsp/.ibmxpr/widget/layout/layers/nls/ClientDojo_en-us.js' is not allowed"

 

However I can access the link from the z10 browser just fine as it opens the js file.

 

I've also tried using:

 

<access uri="http://host.server.org" subdomains="true">
    <feature id="blackberry.app" required="true" version="1.0.0"/>
    <feature id="blackberry.invoke" required="true" version="1.0.0"/>
  </access>

 

 

within the config.xml file, but the new window opens which is the original problem.  However, it renders as expected just like opening url in the device's browser.


Seems like even though the uri is set to allow all, there is still a security issue getting the js files from the server.

 

 

Have you seen any querks like this?

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

Re: How do you open a single page within BB10 Webworks build?

Hi,

 

You wlil need to explicity whitelist any extenal resources loaded via XHR. This is outlined in the documentation:

 

http://developer.blackberry.com/html5/documentation/access_element_834677_11.html

 

 

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: How do you open a single page within BB10 Webworks build?

[ Edited ]

Ooops... Forget my reply, I did not read your last bit of code carefully... I'll take another look soon.

 

@Bryan - He did, using 

<access uri="http://host.server.org" subdomains="true">
--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: How do you open a single page within BB10 Webworks build?

@gdsimz - Try disabling the child browser.

 

childBrowser

Disables child browser windows. By default, when the content attempts to open a resource in a new window or tab (by using window.open(), or by specifying _blank as the target of an anchor), the WebWorks app will open a secondary browser window to display the resource. This feature is enabled by default.

When name="childBrowser", the value attribute must specify a value of "disable".

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

 

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.
Retired
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: How do you open a single page within BB10 Webworks build?

Skimmed over that too quickly :smileyhappy:

 

Double check your URLs. The error message says server.host.org but the whitelist is for host.server.org.

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
New Contributor
Posts: 7
Registered: ‎03-28-2013
My Device: CURVE
My Carrier: ATT

Re: How do you open a single page within BB10 Webworks build?

Your suggestion worked and the page is loading as expected.  Thanks for your help! 

 

 

 

 

Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: How do you open a single page within BB10 Webworks build?

Great news :smileyhappy:
--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.