Enabling the
Web
Inspector
Enabling the
Web
Inspector for the
BlackBerry Browser
Enabling the
Web
Inspector for the
BlackBerry Browser on
BlackBerry Tablet
OS
-
On a
BlackBerry
tablet or on the
BlackBerry Tablet
Simulator, open the
BlackBerry Browser.
-
In the browser, swipe down from the top bezel to display the
browser's menu bar.
-
Click the
Options icon to display the browser
Options screen.
-
On the browser
Options screen, select
Privacy & Security.
-
On the
Privacy & Security panel, slide the
Enable Web Inspector setting to
On.
The browser displays the IP address and the port number
(1337) required to connect from your desktop browser.
-
If prompted, type your device password to complete the enabling
process.
-
Click the
Back button at the top of the display to save
the
Options settings and return to the browser
window.
You can now open a
connection to the
BlackBerry Browser to remotely inspect the page that it is displaying.
Enable the
Web
Inspector for the
BlackBerry Browser on
BlackBerry 7
-
On a
BlackBerry
smartphone or on the
BlackBerry Smartphone Simulator, open the
BlackBerry Browser.
-
In the browser, open the browser menu and click
Options.
-
In the
Web Content portion of the screen, check
Enable Developer Tools. Enabling the developer
tools causes the
Developer Tools menu item to be displayed in
the browser menu.
-
Save the change and exit the
Options screen.
-
Open the browser menu, and select
Developer Tools > Enable Web Inspector.
The browser displays a dialog box that indicates that the
Web Inspector is now enabled, and provides the IP address and the port number
(1337) required to connect from your desktop browser.
You can now open a
connection to the
BlackBerry Browser to remotely inspect the page that it is displaying.
Enable the
Web
Inspector for a
BlackBerry
WebWorks application
You can use the
Web
Inspector to inspect web content displayed in a
BlackBerry
WebWorks application. In a
BlackBerry
WebWorks application, you enable the
Web
Inspector at compile time.
Note:
The
Web
Inspector should only be enabled during the testing phase of development.
When the application is ready for production, you should recompile the
application without the
Web
Inspector enabled.
-
Run the
BlackBerry WebWorks
Packager from a command prompt.
-
At the command prompt, change to the installation folder for the
BlackBerry WebWorks
Packager.
-
In the command to compile the application, include the
-d option flag to enable the
Web
Inspector. For example:
bbwp "C:\myapp\myarchive.zip" -d -o "C:\myapp\output"
When you load this
BlackBerry
WebWorks application on a
BlackBerry device
or simulator and run it, a dialog appears that indicates that the
Web
Inspector is enabled, and provides the IP address and the port number
(1337) required to connect from your desktop browser.
Enable the
Web
Inspector for an embedded browser object in a
BlackBerry Java Application
You can use the
Web
Inspector to inspect web content displayed in an embedded browser object
in a
BlackBerry Java Application. In a
BlackBerry Java Application, you enable the
Web
Inspector for the application by setting a property within the code.
Note:
The
Web
Inspector should only be enabled during the testing phase of development.
When the application is ready for production, you should recompile the
application without the
Web
Inspector enabled.
Before you begin:
This procedure assumes you have already created a functional
BlackBerry Java Application that includes an embedded browser object to display HTML
content. To learn how to create an app that includes an embedded browser
object, see
Enhanced support for web content in
BlackBerry
device applications in the
BlackBerry Java SDK
Integration Development Guide.
-
In the screen constructor in your application, if you have not
already done so, create an instance of the
BrowserFieldConfig class.
BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
-
Set the
ENABLE_WEB_INSPECTOR property for your
BrowserFieldConfig object to a value of
TRUE.
myBrowserFieldConfig.setProperty(BrowserFieldConfig.ENABLE_WEB_INSPECTOR,Boolean.TRUE);
-
In your code, where you have created an instance of the
BrowserField class, pass in the
BrowserFieldConfig object.
BrowserField browserField = new BrowserField(myBrowserFieldConfig);
When you open a
BlackBerry Java Application with the
Web
Inspector enabled on a
BlackBerry
smartphone, a dialog appears that indicates that the
Web
Inspector is enabled, and provides the IP address and the port number
(1337) required to connect from your desktop browser.
Code sample: Enabling the
Web
Inspector in a
BlackBerry Java Application
The following code sample demonstrates how to enable the
Web
Inspector in a
BlackBerry Java Application.
import net.rim.device.api.browser.field2.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
public class HelloWorld extends UiApplication
{
public static void main(String[] args)
{
HelloWorld app = new HelloWorld();
app.enterEventDispatcher();
}
public HelloWorld()
{
pushScreen(new HelloWorldScreen());
}
}
class HelloWorldScreen extends MainScreen
{
public HelloWorldScreen()
{
BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
myBrowserFieldConfig.setProperty(BrowserFieldConfig.ENABLE_WEB_INSPECTOR,Boolean.TRUE);
BrowserField browserField = new BrowserField(myBrowserFieldConfig);
add(browserField);
browserField.requestContent("http://www.blackberry.com/");
}
}
Was this information helpful? Send us your comments.