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

Java Development

Reply
Developer
Developer
jcr
Posts: 42
Registered: ‎04-01-2009
My Device: Not Specified

Re: Loading a local html file in the browser

Thanks!
Developer
almeida
Posts: 91
Registered: ‎02-04-2009
My Device: Not Specified

Re: Loading a local html file in the browser

BBDeveloper, I've been trying to do the same thing and your sample code works great.  Thanks.

 

Is it possible to link from one local HTML file to another?  If in foo.html I have a link like <a href="bar.html">bar</a>, the browser interprets that as "data://text/bar.html" and gives this error when you click on it: "A problem occurred while trying to render the page."

 

Any thoughts? 

Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Loading a local html file in the browser

I tried, providing the Absolute path of other local html file from first local html file and it worked.

 

Example: 

<a href="cod:///[Module Name]/BBDeveloper.html">Next page To COD</a>
<a href="file:///store/home/user/BBDeveloper.html">Next page</a>

 

PS: Tried using JDE 4.6on 9000 Simulator.


Use Search. "Accept Solution" If the problem is resolved.
Developer
almeida
Posts: 91
Registered: ‎02-04-2009
My Device: Not Specified

Re: Loading a local html file in the browser

[ Edited ]

The cod://... link works perfectly.  Also, it eliminates the need to deal with InputStreams, DataBuffers, byte arrays, etc.  I can now just load a local page directly in a BrowserSession:

 

Browser.getDefaultSession().displayPage("cod://<module>/<file>");

 

Thank you very much, BBDeveloper.  This was a huge help. 

Message Edited by almeida on 04-16-2009 10:13 AM
New Contributor
chinmay63
Posts: 6
Registered: ‎04-28-2010
My Device: Storm 9500

Re: Loading a local html file in the browser

Absolutely works fine !

I had a problem with OS 5.0 with previous code was giving out of memory error

This single line has solved the problem