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: 2
Registered: ‎03-12-2014
My Device: Z10
My Carrier: none
Accepted Solution

no access to my javascript code after window.location

Hi,

 

I'm working with Webworks 2.0. I have setup my project, doing some stuff in index.html (inline javascript code) and then I use window.location to a link where is another web app which i need to show in my blackberry app.

After window.location, the code in the index.html is not working anymore. Is it possible to use window.location and still use the code in the index.html ? (imagine that there is there code to handle push notifications for example)

Developer
Posts: 33
Registered: ‎10-29-2013
My Device: BB10
My Carrier: TMO

Re: no access to my javascript code after window.location

Setting new window.location value will move you to the other page. You need to have a proper js file/code to be included there. Your original code from index.html will not be available there.

New Contributor
Posts: 2
Registered: ‎03-12-2014
My Device: Z10
My Carrier: none

Re: no access to my javascript code after window.location

Does it matter if this code is in a file placed in a remote machine and not in the device ? Will I still be able to have access to the webworks api ?
Highlighted
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: no access to my javascript code after window.location

You can have access to the WebWorks API but you will need to whitelist those features through an <access> element.

 

For example, if I want to use the blackberry.app APIs and my config.xml is pointing at an index.html that is hosted on my own server (i.e. http://www.myserver.com), then I would need to whitelist as follows.

 

<access uri="http://myserver.com" subdomains="true">
    <feature id="blackberry.app" />
</access>

 

This would allow the remote location to execute the white-listed WebWorks APIs on the device.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.