How to set User-Agent in WebBrowser Component ?

78 views
Skip to first unread message

Robert Bluschke

unread,
Feb 20, 2014, 3:40:22 AM2/20/14
to codenameone...@googlegroups.com
Hi I am Robert and new to the CN1-Community,

I have a few Questions about the WebBrowser Component.

First is in the Headline, how can I set the UserAgent in this Component, I saw it is possible with the ConnectionRequest Object, but don't find any Methode for the Browser Component.

Second Question is, how to remove the scrollbars and make it fullscreen?

Third Question, is it possible to add some Controls in the Browser or do i have to add the controls around this field?

Best wishes,

Robert

My Implementation is like this:

WebBrowser browser = new WebBrowser();      
        browser.setPropertyValue("User-Agent", hSManager.getAccountVerwaltenUserAgent());
        browser.setURL(hSManager.getAccountVerwaltenUrl());
        Form f = new Form();
        f.setLayout(new BorderLayout());
        f.addComponent(BorderLayout.CENTER,browser);
        f.show();


Shai Almog

unread,
Feb 20, 2014, 1:06:10 PM2/20/14
to codenameone...@googlegroups.com
Hi Robert,
we don't currently support setting the user agent of the browser component.
The browser should be full screen with your current implementation since you didn't define a title, there might be a bit of padding/margin on the sides which you can remove by styling the BrowserComponent UIID.

The scrollbars you see probably aren't from us, if they are on the simulator they will look differently on the device. You can probably style both thru CSS.

The browser is on its own space since its a native component, you can't add Codename One controls into it or on top of it.
Message has been deleted

Greenkohl23

unread,
Feb 26, 2014, 5:12:11 AM2/26/14
to codenameone...@googlegroups.com
Thx i was able to fix it, with your help.

I work around the problem and load the css for mobile with javascript. 
Reply all
Reply to author
Forward
0 new messages