3

how to open default blackberry browser when click on browserfield. i am trying load a html page on browserfield when i click on opened browser page that time i want to open blackberry default browser.

BrowserField browser = new BrowserField();

    MyBrowserFieldListener listener = new MyBrowserFieldListener();
    browser.addListener(listener);

    MainScreen screen = new MainScreen();
    screen.add(browser);
    pushScreen(screen);

    browser.requestContent(url);

i use this code it works but it also load in browserfield i dont want to load on browserfied

jprofitt
  • 10,874
  • 4
  • 36
  • 46
Mayur Bhola
  • 735
  • 5
  • 17
  • Your question is kind of confusing. Do you want to use a BrowserField or not? Are you wanting to open the URL in the actual browser, or do you mean you want to initially load a page with the BrowserField and then have links clicked in that open up in the BB browser instead of the BrowserField? – jprofitt Aug 19 '11 at 15:31
  • i have an html that have a URL. first i was load html in BrowserField when i click on loaded html than i get a URL. i want to open this URL in blackberry native browser but i don't want to any change in my html means fetched URL should not load in browserField or stay as it is.. – Mayur Bhola Sep 07 '11 at 11:36
  • If you have any idea related this issue please help me..... Thanks in Advance...... – Mayur Bhola Sep 07 '11 at 11:42

1 Answers1

0

It is always easier to answer questions when they have some information on what you are trying to accomplish. Like jprofitt I'm confused about what you want to happen. However, it is a bit of a kluge but you could:

  1. in MyBrowserFieldListener detect that a link has been clicked when documentLoaded is called;
  2. get the URL from the BrowserField with getDocumentUrl();
  3. Launch the default browser with that URL;
  4. If you want the BrowserField to remain on the original page call requestContent() or back().
Richard
  • 8,920
  • 2
  • 18
  • 24
  • --- can u please describe your fourth point bcoz i want to make little bit same i want to open new getDocumentUrl(); in my device default native browser and than want to restrict the same url to load on browserfield --- 4. If you want the BrowserField to remain on the original page call requestContent() or back(). – Mayur Bhola Aug 25 '11 at 06:02
  • 1
    When the user clicks on a URL in the BrowserField, the field will load that URL. There are two ways to get it back to the original page: issue another call to requestContent() with the URL you want displayed there (this is probably the best choice as it will avoid redirection) or issue a call to back() which will cause the field to go to the previous URL in the history stack. A more complicated way would be to use the BrowserFieldConfig to set the BrowserFieldController and over ride handleNavigationRequest() but I don't have any experience with that. – Richard Aug 25 '11 at 12:35
  • 1
    thanks for your reply.. i want only the url when user click on link but here i want to restrict browser field to load link and that link i want to open in default native browser. i use browserfield.back() method but it occurred problems some time or not work properly. you have any idea how to pause or stop or restrict the browser field. – Mayur Bhola Aug 25 '11 at 13:25
  • 1
    The BrowserFieldController seems to provide that, but the only way to set it is with the BrowserField(BrowserFieldConfig config) constructor. I haven't used this myself so I can't be any more helpful. – Richard Aug 25 '11 at 15:29
  • I use back method when load browserfield but it occurred problem sometime. have you any other idea.....? – Mayur Bhola Sep 07 '11 at 11:44