Ok, my apologies for the first answer. I think DOCTYPE
was a red herring (but I didn't have your Java code at the time).
I see a few potential problems:
Network Connectivity
First, as is always the case, make sure you have network connectivity for your device, or simulator. That may include the MDS simulator running. You can always test connectivity with the normal Browser app, checking a website you know to be running. I believe that if you have a total lack of connectivity (i.e. network disabled), then you will get your frames showing just the text / URLs. However, I believe it will also have something like this:
Could not select proper Transport Descriptor for: http://www.penny-arcade.com
instead of showing null
, as you show.
Adding BrowserField
Next, I think there is a problem with you asking the browser field to display content before you've added the field. Simply switch the order of those two lines of code to this:
add(browserField);
try
{
String embeddedLinkFrame = readTextFile("frame.html");
browserField.displayContent(embeddedLinkFrame, "http://localhost");
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
I believe the behaviour if you have these lines out of order, however, is just to get a blank browser field.
Viewport Properties
Lastly, I would not recommend setting page properties programmatically, as you've done. Although this is not going to keep your page from displaying, I'd recommend putting those properties in HTML meta
elements:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
Update: Protocol Controller
Unfortunately, my simulator is acting up, and declining to support hot-swap right now. So, it's hard for me to run many times, and collect decisive results. But, it looks to me like removing your ProtocolController
object prevents this problem from happening for me. (maybe you can clarify why you're using the protocol controller in this situation?). If this answer was a motivation, you might look carefully at the poster's full comments about it's usefulness.