[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Browser object and getUrl()

Thank you Grant!  Exactly what I needed.
Best regards,
Benoit

Grant Gayed a écrit :
Hi Benoit,

You can use javascript to do this, with a line like:

browser.execute("document.location = '#linkName';");

Note that if you're on Windows then this will not work with IE versions less
than 7, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=117108.  I've
verified that this works on linux and OSX.

Grant


"Benoit Mercier" <benoit.mercier@xxxxxxxxxxxxxx> wrote in message news:fqrh57$i0$1@xxxxxxxxxxxxxxxxxxxx
Hi,

I use org.eclipse.swt.browser.Browser.setText(html) method.

How can I ask the browser to scroll to a specific HTML anchor AFTER the
html content has been set via setText()?

I understand that getUrl() returns the URL previously set by setUrl().
So getUrl() returns null when setText() has been used instead of
setUrl().  Otherwise I would have been able to get the URL of the
temporary generated file (?) and to append to it my anchor (getUrl() +
"#anchorId")

Would it be possible to have a method on Browser returning its "real"
URL (if any) or a way to ask the browser to scroll to a specific anchor
(i.e. Browser.scrollTo("anchorId"))?

It would allow easy synchronization between SWT component and HTML
content,
Thank you very much in advance for your support.

Best regards,

Benoit
(mercibe)