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
Contributor
Posts: 20
Registered: ‎08-25-2011
My Device: Bold 9650
My Carrier: Generic
Accepted Solution

Can anyone help - simple page not rending

[ Edited ]


Hello all,

 

I have a relatively simple HTML page.  The one complex part of the page is that it is pulling a complex JavaScript library from a remote provider.

 

I get several errors, including one that says I have a cross domain issue.  I have tried whitelisting the outside resources and listing the url's separately in the config.  Both methods get me the same result. 

 

If there are any WebWorks guru's out there could you take 5 mins and try running my simple page and let me know what the issue is?  Even if this can't ever work, I'd like to know why.

 

Thanks!!

 

Here's the link to the online resource for this code sample:

 

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/mobile_simplemap.html

 

Here's a link to a live sample:

 

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/mobile/mobile_simplemap.html

 

Here's the code

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>  
<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" /><title>Untitled Page</title>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4compact"></script>       
<style type="text/css">           
	html, body             {                height: 100%;                margin: 0px;                padding: 0px;                width: 100%;            } </style>       
<script type="text/javascript">                       
        dojo.require("esri.map"); 

	var map;                     
	function init() {               
		var initialExtent = new esri.geometry.Extent({                 
			"xmin": 244598,                 
			"ymin": 6241389,                 
			"xmax": 278995,                 
			"ymax": 6264320,                 
			"spatialReference": {                   
				"wkid": 102100                 
			}               
		});               

		map = new esri.Map("map", {                 
			extent: initialExtent               
		});               
		var tiledMapServiceLayer = new			esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");                map.addLayer(tiledMapServiceLayer);                       
}
/scrip/heabody onloadinit(       div idma/di/bod

Tommy Bramble
Contributor
Posts: 20
Registered: ‎08-25-2011
My Device: Bold 9650
My Carrier: Generic

Re: Can anyone help - simple page not rending

[ Edited ]

Here's the related link from another forum:

http://forums.arcgis.com/threads/38672-BlackBerry-WebWorks-2.4Compact

 

One other note.  The above code actually works in the Beta Ripple emulator.  However, it will not run on a simulator or on the physical device.

Tommy Bramble
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Can anyone help - simple page not rending

Hi Tommy, 

 

The challenge with someone helping you out is that while you consider it a simple web page, it is linking in a JavaScript library that has thousands of lines of JavaScript code. The problem could be in one single line of the JavaScript code.

 

The only thing I can suggest is that you ensure that you have your whitelist set properly in your config.xml file to ensure that you are allowing content to come in from all the domains that the JavaScript library may be pulling content from.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 20
Registered: ‎08-25-2011
My Device: Bold 9650
My Carrier: Generic

Re: Can anyone help - simple page not rending

Tim,

 

Thanks for the reply!  I understand, and didn't expect anyone to debug the external library, just wanted to make sure I hadn't overlooked something really simple is all.  I'm only 3 weeks into this framework and still not confident with some of the general stuff.

 

Thanks for checking it out!

 

Here is what I use for the whitelist in my config.  If that's not correct please advise.  Otherwise, thanks again.

 

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

Tommy Bramble
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Can anyone help - simple page not rending

That does look correct...

 

What I would do if I were you, is strip out all the JS toolkits and get a simple Hello world page up and going and then add in parts piece-by-piece.  This will tell you where the problem lies.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 20
Registered: ‎08-25-2011
My Device: Bold 9650
My Carrier: Generic

Re: Can anyone help - simple page not rending

Yeah, the Dojo Toolkit seems to load and work fine when I separate it.  It's something with that Esri JS API and how it's trying to load the supporting resources I think.

 

For now anyway, I'll be sticking with Google Maps v3 API, which is working in my WebWorks application.

 

 

 

 

Tommy Bramble
Contributor
Posts: 20
Registered: ‎08-25-2011
My Device: Bold 9650
My Carrier: Generic

Re: Can anyone help - simple page not rending

FYI...for anyone else trying to get a javascript mapping api to work in their WebWorks apps....

 

I'm having pretty good luck using OpenLayers (www.openlayers.org) on the device.  OpenLayers seems to trigger the out of memory issue less frequently than google maps for me.

 

Plus you can customize your OpenLayers build so it only includes the component libraries you need (as opposed to the full source download).

 

 

Tommy Bramble