|SWT Browser event listener issues [message #1016285]
||Tue, 05 March 2013 20:07
| Carsten Reckord
Registered: June 2012
I'm using the SWT Browser component to show a website in an Eclipse Dialog.
I'm trying to handle links on that page specially through listeners
registered on the Browser, but I'm running into issues there.
What I'm trying to achieve is basically to open any link leading away from
the page in an external browser window using the IWorkbenchBrowserSupport.
Here's the problems I'm encountering:
1) LocationListener.changing(...) is not just called for "real" navigation
events (i.e. those that would change the Browser's URL), but also for
scripts that dynamically load additional content and for embedded objects. I
can't see any clear way to discern between the two.
2) Some links on the page have a target (e.g. target="_blank"), causing them
to open in a separate window/tab. I'd like to trap that, too, and handle it
through the BrowserSupport. However
a) while the notified OpenWindowListener can cancel the operation (so I
could theoretically trigger the IWorkbenchBrowserSupport instead). However
there seems to be no way to access the URL that should be opened at this point.
b) no LocationEvent is fired for those events
As a workaround for 2) I'm currently rewriting the DOM on load and removing
all target attributes. However, that doesn't fix cases of window.open() or
new links from dynamic DOM manipulation...
As a corollary to 1) it seems that every one of those dynamic load cases
also comes with its own progress events which I receive interleaved with the
"main" progress without a clear way to separate them.
Powered by FUDForum
. Page generated in 0.01855 seconds