If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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 Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800
Accepted Solution

Playbook - Webworks - Javascript & Jquery problems

[ Edited ]

I am having problems with my compiled Webworks application.

The application works fine "as source" in Firefox and as an AIR application using Aptana Studio.

However, when I compile the HTML/Javascript files the app does not compile as expected.

 

When I use

onclick="window.open('index.html?foo=bar')"

it gives "network error" (see picture below), while it's just opening itself with a querystring.

 

 

 

The $functions of Jquery get ignored too for example a piece of code like this:

 

		$(
			function(){
				loadSelectedFoto();
				setDiff();
				loadHs();
				$( "div.puzzle, p" ).puzzle( memdiv );
			}
			);

 

Is this due to Webworks Beta status, or am I doing something that just can't be done this way (before the PB offer :smileywink: )

 

 

 

networkerror

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Playbook - Webworks - Javascript & Jquery problems

Are you remotely loading jQuery or packaging it in your WebWorks application.  If you are bringing in outside resources into your WebWorks application you will need to white list the domain.  This is done in the <access> element in the config.xml file.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800

Re: Playbook - Webworks - Javascript & Jquery problems

[ Edited ]

I package it in the application. It's working standalone without internet connection.

With compressed jQuery 1.5 completely pasted in a .js file.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Playbook - Webworks - Javascript & Jquery problems

I may be wrong.. but I believe that window.open() without specifying a target will assume "_blank", which I am pretty sure is meant to open a new window.

 

http://www.w3schools.com/jsref/met_win_open.asp

 

In the browser this "may" open a new tab, but there isn't multiple tab/window support inside a webworks application.  This could be the source of the problem

 

I unfortunately don't knwo what may be going on with the jQuery function

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800

Re: Playbook - Webworks - Javascript & Jquery problems

 

function changePic() {
	window.location = "index.html?foo=bar";
} 

 

 

Gives the network error.

 

location.ref and window.open instead of window.location all give the exact same network error as in the picture of my original posting :smileysad:

 

Today I tried using the code of the WebWorks application given in september in the San Fransisco Lab (DEV45: BlackBerry Widget Bootcamp and Code-a-thon).

 

My Eclipse compiles the sources as it should for the phone, but the Playbook WW compiler does not give the same result.

 

Network Errors when navigating.

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Playbook - Webworks - Javascript & Jquery problems

[ Edited ]

Ah.. I believe this is a problem I also reported in the beta.. It has since been fixed but has not yet been released.. stay tuned an update is coming soon.

 

Basically I believe it is the query string parameters on the end of the URL that is causing the issue.  For now you will likely have to pass the data through cookies or other means until this bug gets released in the next Beta drop.

 

This issue also shows itself when making local requests.  It also affects local AJAX or populating an iframe with a local URL that has query string parameters.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800

Re: Playbook - Webworks - Javascript & Jquery problems

Okidoki I'll just wait for the next beta then, thank you very much for the explanation.

Please use plain text.
New Contributor
danjarvis
Posts: 7
Registered: ‎03-19-2010
My Device: Lots
My Carrier: Lots

Re: Playbook - Webworks - Javascript & Jquery problems

Can somebody confirm if this issue is definitely now fixed, and what release the fix was delivered in?

Please use plain text.
New Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800

Re: Playbook - Webworks - Javascript & Jquery problems

Yes I can confirm it is fixed.
Please use plain text.
New Developer
oscoweb
Posts: 17
Registered: ‎01-20-2011
My Device: Torch 9800

Re: Playbook - Webworks - Javascript & Jquery problems

[ Edited ]

It is fixed in the sdk released at the time the 0.9.4 simulator was unleashed.

 

WebWorks SDK v1.0.0.23 Beta3 

 

Cheers

Please use plain text.