[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Browser Javascript problems on SLES

Hi Richard,

This javascript works for me on SLED10.  Does the snippet below work for you
(it prints its status line to stdout, and runs your javascript whenever the
parent shell is resized)?  Also, the very first line(s) that are written to
stdout should indicate which xulrunner/firefox/mozilla/etc. is being
detected and used.  What is it for you?

public static void main(String[] args) {
    Device.DEBUG = true;
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    final Browser browser = new Browser(shell, SWT.NONE);
    shell.open();
    shell.addListener(SWT.Resize, new Listener() {
        public void handleEvent(Event event) {

browser.execute("window.status=document.body.scrollWidth.toString()+\"x\"+do
cument.body.scrollHeight.toString()");
        }
    });
    browser.setUrl("http://www.google.com";);
    browser.addStatusTextListener(new StatusTextListener() {
        public void changed(StatusTextEvent event) {
            System.out.println("status received: " + event.text);
        }
    });
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
}

Grant


"Richard Bone" <rabone@xxxxxxxxxx> wrote in message
news:d13dc4816309b5f402d0feca9602e51f$1@xxxxxxxxxxxxxxxxxx
> Hi,
>
> We've been using the browser widget with javascript and haven't had any
> trouble on windows.  When we run on linux, however, the story changes.
>
> I haven't tried other distributions, but I have tried on SLES 10, which
> comes out of the box with Firefox 1.5.x.  We are passing in the following
> javascript...
>
>
browser.execute("window.status=document.body.scrollWidth.toString()+\"x\"+do
cument.body.scrollHeight.toString()");
>
> On windows, this returns a string that might look like 640x16.  On SLES,
> the browser throws a dialog up that says "Unable to open Web browser on
> javascript:<script from earlier>;void(0);  Reason: unknown protocol:
> javascript.
>
> The browser widget itself works fine, until I use javascript.  If anyone
> has any ideas on why this might be happening, I would love to hear them.
>
> Richard
>