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: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Cannot read property 'BrowserArguments' of undefind

Greetings

 

This code works when compiled with SDK 2.1 but not 2.2.

 

var args = new blackberry.invoke.BrowserArguments('http://www.blackberry.com');
blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);

 

Originally broke in my current apps.  I created a plain old test project following the getting started examples and still have the same issues. 

 

Please help.

 

 

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Cannot read property 'BrowserArguments' of undefind

Hi Postma,

 

I just want to confirm you have the correct entries in your config.xml 

<feature id="blackberry.invoke" />
<feature id="blackberry.invoke.BrowserArguments" />
<feature id="blackberry.identity" />

 




1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Re: Cannot read property 'BrowserArguments' of undefind

ah,  forgot that in my quick test in ripple.  Ripple works with that in the config.   Can't test on a device until later.

 

For my published apps on real devices,  this is my current config.   I may have to go back and read the documentation for upgrading?

 

feature id="blackberry.identity" required="true" version="1.0.0.0">
feature id="blackberry.invoke" required="true" version="1.0.0.0" 
feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.1.0" 

 

Ripple likes it,  but the devices throw a constructor error of some sort.  Forgive me,   I'll have to wait until later to get that. This works just fine with SDK 2.1


Contributor
Posts: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Re: Cannot read property 'BrowserArguments' of undefind

Actual error on the device is :

TypeError: Result of expression 'new blackberry.invoke.BrowserArguments' [undefined] is not an object.

 

Test devices:

9780,9800,9700,9300 and 8520

 

 

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Cannot read property 'BrowserArguments' of undefind

Hi Postma,

 

That error means that the javascript has not been loaded.

 

You've already confirmed that the feature IDs are present, but this only allows them to be used for local resources. If you're trying to use them from remote resources they need to be nested in the associated access tags.

<access uri="http://dl.dropbox.com/u/45145424/index.html" subdomains="true">
        <feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.0.0"/>
        <feature id="blackberry.identity" required="true" version="1.0.0.0"/>
        <feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
    </access>

 

Can you package with the "-s" option and make sure that the extension is included in your source.

 

If its neither of these, is it possible something is overwriting the blackberry object?





1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Re: Cannot read property 'BrowserArguments' of undefind

Thanks,  I'll look into this later tonight when I have time.  

 

I wonder what the difference is between SDK 2.1 and  SDK 2.2 for this to happen.

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Cannot read property 'BrowserArguments' of undefind

[ Edited ]

Hi Postma,

 

I missed that this was a bug on the 2.2 switch, thats definately bizarre.

 

I just ran a test on a 9800 using 2.2 and didn't see this issue at all. If nothing else solves it I'll likely need OS versions you're seeing this on and whether you're using local or remote resources.

 

**Edited



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Re: Cannot read property 'BrowserArguments' of undefind

I tried the suggestions above with no success.

 

I get feature not allowed in access element btw.

 

Anyway,  I resorted to tearing things out until it stared working.  I was much more methodical this time.   Apparently having iframe elements in the HTML seem to cause this issues with SDK 2.2.  I remove them the invoke browser works,  I add them back in and it stops working.  I build with SDK 2.1 with the iframes and it works.  Rebuild with SDK 2.2 and it stops working.

 

Here are my config, and HTML files:

 

<?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>Test</name>
<description></description>
<feature id="blackberry.identity" required="true" version="1.0.0.0" />
<feature id="blackberry.invoke" required="true" version="1.0.0.0" />
<feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.0.0" />
<content src="index.html" />
</widget>

 

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0">
<title> Hello World </title>
</head>
<body>
<button onclick="makeerrors()">browser errors</button>
<iframe></iframe>
</body>
<script type="text/javascript">
function makeerrors() {
try {
alert("ready");
var args = new blackberry.invoke.BrowserArguments('http://www.blackberry.com');
blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
}
catch (e) {
alert(e);
}
}
</script>
</html>

 

 

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Cannot read property 'BrowserArguments' of undefind

Hi Postma,

 

I am definately able to reproduce the bug. Its definately quite bizarre. I have logged an issue on Git here https://github.com/blackberry/WebWorks/issues/66



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 17
Registered: ‎08-19-2011
My Device: none
My Carrier: none

Re: Cannot read property 'BrowserArguments' of undefind

Thanks Jeff.  I appreciate your assistance.