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
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Embed HTML in a widget

I want to embed some remote html pages into my widget I'm working on.

 

What is the easiest way to do this?

I tried a simple iframe to do it, just to get it working for a test, but this will not work on the device. 

I also tried inserting it as an object, but this also doest not work.

 

Any examples of how to best implement this? Thanks in advance!

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

Re: Embed HTML in a widget

Hi There,

 

I just want to be clear on what you are looking for so I have a few questions for you:

- Are the pages your own pages, or from another site/vendor? (different possible solutions for different scenarios)

- Are you looking to embed their content into your page, or simply bring them up into the widget to be displayed?

 

Thanks

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Re: Embed HTML in a widget

I guess it would make it a little easier to answer wouldn't it!

 

I have a few widgets I would like to make. Both would be served by my own website, using my own pages. So I have access to both ends of the equation.

 

The first widget would embed a remote php page, that contains a form, and would then send the results of the form back to the php page. Where it would then act on the results.

 

The second widget would actually be a forum widget, interacting with my vbulletin based php forum.

 

Does that tell you enough about how I want to use it?

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

Re: Embed HTML in a widget

Sure.. that helps.

 

You have a couple of options for your first screen in your widget.  You can make it either locally embedded into the widget or make it pull from an outside URL (aka your website).  You can set this first page using the <content> element in your widget.

 

I've found that a local page loads much quicker in your widget than a remote page for obvious reasons, so it will depend on if you want faster load times v.s. easier to change dynamic first page.

 

You will need to make sure you whitelist the domain for your websites using the <access> elements.  Be sure to check out the Developer guide on how to do this.  Otherwise outside resources are not allowed into the widget.  You must explicitly declare them.

 

Another interesting feature you may want to take advantage of, is that you can configure a "rim:header" attribute in the config.xml file so that your own personal header will be sent on any web request from your widget. That way you will know from your website, or vbulletin site, that it is being hit by your widget.  This means that you can put in some custom server logic that would provide tighter integration with your widget than what you can do in the browser.

 

An example of this would be if you detected your widget, you could serve up JavaScript that would add menu items to the BlackBerry menu to perform actions.  Or if someone clicked on a button in your HTML you could then invoke on-device applications or interact with the PIM

 

Hopefully this answers your question and I didn't go on too much of a rant Smiley Happy

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Re: Embed HTML in a widget

Do you have some examples of how to do this in the ways you mentioned?

New Developer
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Re: Embed HTML in a widget

Oh and when I tried it before, using an <iframe> for a simple version, I would get the following where my iframe should be:

 

http://www.mywebsite.com/forums/mypage.php null

 

Any ideas?

 

I had the access set correctly also.

New Developer
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Re: Embed HTML in a widget

Sorry I should have added that I want to run as much content local as possible for speed reasons.

My widget has all the images and content local, apart from the php remote form in question, which will be accessed from a certain page in my widget.

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

Re: Embed HTML in a widget

Yes, we are trying to track down the iframe issue... 

 

To bring in your php remote form, you should just be able to put a hyperlink in your local content to the url of your remote form.  It will then pull the remote form into your widget container and display it as long as it has been whitelisted

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 23
Registered: ‎11-05-2009
My Device: Not Specified

Re: Embed HTML in a widget

I don't know why I didn't think of just linking to it. lol

I guess I was over thinking the whole thing!

 

Do you have any examples of fetching pages as XML and then dealing with them?