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: ‎02-24-2010
My Device: 9700
Accepted Solution

direct in bb browser vs showing pages from the Visual Studio Plug-in

I am using Visual Studio 8 with the latest Sun Java and the beta 2 of the plug-inI am using 32 bit Windows 7... I know this isn't directly supported, but it does appear to be working for the most part and I don't have an XP or Vista machine available to me.

 

I have been able to make most of the sample applications workI can directly browse my .net web siteI have another post about not knowing where the commands are.

 

I understand that displaying pages is differentI set up some simple links on the index.htm page in the widget I am building. i.e.

 

<

<

These are inside the <body section of the index.htm widget.  While I can retreive the pages all of the css styles are stripped and it is raw and I get render errors.  Is there some way to retrieve pages from outside html resources and not lose the css style formatting?   Will one of the 5 browser models work better? 

Also, since I don't know where the command reference... how do I make a url call programmatically in the JavaScript?

a href="http://xxx.xxx.x.x/Trade/SPLogin.aspx">Link</a> a href="http://finance.yahoo.com">Link2</a>

 

Thank you in advance,

Scott

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

Re: direct in bb browser vs showing pages from the Visual Studio Plug-in

Hi Scott,

 

In order to bring in outside resources into your Widget, you will need to white list their full domain.  For example http://www.blackberry.com.

 

This can be done in the config.xml editor where you can add domains that are white listed to your widget.  This includes any images, css, htm, js or any other resource for your widget.

 

For calling a URL from JavaScript, are you just looking to change the root document for the current session.. in that case you can use the standard "location.href" JavaScript object.

 

If you want to pull data from a URL behind the scenes you can use standard AJAX calls.  

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 17
Registered: ‎02-24-2010
My Device: 9700

Re: direct in BB browser vs. showing pages from the Visual Studio Plug-in

Tim,

 

thank you.... the window.location.href property suggestionhelped tremendously  :smileyvery-happy:

I already had my rmote site whitelisted in the widget config.xml.  So that wasn't my issue.

 

Even with the window being redirected to the remote web site page.... it still shucked the CSS property formatting.

 

Sorry to bother you.  Your suggestion on setting the window.location.href property took me a long way to where I want to go with this application.  I do have several more related questions if you could please help:

 

Environment:  32-bit Windows 7, most recent Java development environment from Sun, Visual Studio 8 most recent BlackBerry Beta Plug-in, 9700 Simulator working fine, whitelisted remote .NET/ASP/SQL Server 2008 to use as remote formatted page server, XMLHTTP requests,  and possibly direct .asp service calls.

 

QUESTIONS:

1)  When inside the Visul Studio Plug-in is it really making XML requests rater than a page request even when you are setting the window.location.href property?... which would mean it is only returning raw page data and no CSS style formatting.

 

2) Also, I had trouble for almost a whole day yesterday when calling/linking to my non Smart Phone remote web site login page... it kept giving an error in the widget plug-in environment  "Error encountered during XML parse: Expecting '>'."  The culprit turned out, after not being able to debug directly, to be comments  i.e.. "<!-- "  in my ASP pages.  It can't seem to deal with this standard comments format and I believe it thinks it is part of the XML.  Which is also why I am starting to believe this is not a true invoke of the BB browser application. 

 

Would I be better off invoking a browser session from within the Widget to get a formatted page from the remote site if that is for example what I want part of the widget app to do rather than reinvent all the CSS etc in the widget application?

 

3) Can I just import the CSS style page from my server application into the VS 8 Plug-in application and the formatting will come back or is it just brining back the XML raw node data and striping the CSS tags when you call it from JavaScript with resetting the window.location.href property?

 

4) As an example, I already have a .NET ASP web site in my LAN which is the remote resource that I am testing with. I would like to request simple or stripped down pages that return a formatted tables of data.  Is this possible or am I going to get an XML request and then I have to format the data inside the widget with JavaScript inside the Plug-in?  This is going to make my widget JavaScript much fatter than I had hoped... I had hoped to do more heavy lifting on the server side.

 

5) I have seen many posts about HTML Tables... I have the impression that HTML Tables are a dirty word in the Smart Phone world.  I noticed in the native/9700 simulator browser application my site retains the CSS, but I have the usual problems with smart phone browsers i.e.. postbacks don't work, etc.  It seemed like when I first started browsing my remote .NET/ASP web site a few days ago the formatted HTML tables were showing up.  After the installs and reinstalls now it seems to have gone away.  So I have started making a Smart Phone version version of my web application that cuts the size down, uses click events, etc.  Is there some quick setting change that will show an HTML table in the BB browser application that I can make? 

 

6) Does the VS Plug-in support standard JavaScript XMLHttpRequests?  Are there any limitations? 

 

7) Finally, I asked in a different post about language references, but since my VS 8 intenseness isn't working on the JavaScript I am flying kind of blind.  Can you point me to some articles or other posts with sample code for making XML requests or the BlackBerry library equivalents, XMLHttpRequests if supported in the Visual Studio Plug-in, and any AJAX sample code you could point me to.?  I can't seem, to find the right place, and I have exhausted the introductory sample applications and videos.

 

I know this is way beyond ... usually a reporter only gets to ask two questions and I am asking 7 new ones.  Just the one word from your previous post "location.href" took me a long way, so I hope you can take the time to give me a piece of advice on each one above.

 

Thank you again,

Scott

Contributor
Posts: 17
Registered: ‎02-24-2010
My Device: 9700

Re: direct in bb browser vs showing pages from the Visual Studio Plug-in

Tim,

 

if you see this before my other post, you can ignore question #2.  After your other post pointing me to the API reference I tried the blackberry.invoke.BrowserArguments  imy widget and it leaves the application and starts an independent browser session from the widget.  This could get me going at least to have a simple widget/package that does nothing more than point to a more Smart Phone browser friendly version of my web application, but I would miss other things I want to do i.e. push notifications to my widget application from the server, use the BlackBerry menus etc. for application navigation.

 

So, while it is painfull, I guess no pain no gain.  My other questions are still relevant about bringing CSS formatted tables in from the server into the widget plug-in application etc.

 

Regards,

Scott

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

Re: direct in BB browser vs. showing pages from the Visual Studio Plug-in

 

If you set the location.href property it will navigate to another page and not just pull in an XML request.  Once that new page loads, if it has JavaScript or CSS files linked to it, it will load those files as well
The Widget uses the same rendering and JavaScript engine as the BlackBerry Browser itself.  We have seen some different rendering issues on CSS in a widget environment as compared to the Browser itself, but they are usually some corner cases.

 

If you set the location.href property it will navigate to another page and not just pull in an XML request.

 

Once that new page loads, if that new page has JavaScript or CSS files linked to it, it will load those files as well.

 

A BlackBerry Widget uses the same rendering and JavaScript engine as the BlackBerry Browser itself.  We have seen some different rendering issues on CSS in a widget environment as compared to the Browser itself, but they are usually some corner cases.

 

BlackBerry Widgets support the standard XMLHttpRequest just like Chrome or Firefox, and all of its functions and properties.  Some AJAX examples can be found here:

http://www.w3schools.com/Ajax/ajax_example.asp

 

From what you are describing, it sounds like you are using some CSS attributes that may not be supported by the BlackBerry Browser.  For a full reference on what CSS, HTML and JavaScript standards are supported in the BlackBerry Browser you can check out the following link:

http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=BlackBerry+Browser

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 4
Registered: ‎03-08-2010
My Device: 8900

Re: direct in bb browser vs showing pages from the Visual Studio Plug-in

do you have any working example on Navigation, i whitlisted my domain on widget but still fail to navigate. thanks.

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

Re: direct in bb browser vs showing pages from the Visual Studio Plug-in

By "Navigation" I think you are referring to bringing in an outside page into your widget... If you have properly white listed your full domain then it should bring in the content.  Also if your target resource performs a re-direct to another domain, you will have to also white list that other re-directed domain.

 

Can you post your <access> element and also the desired URL you are trying to bring in?

 

There is also a tutorial here:

http://na.blackberry.com/eng/developers/devbetasoftware/WidgetTutorial_%20How-to-secure-your-BlackBe...

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter