Hi,

It's not quite as easy as you might expect, depending on what exactly
you are going to do and on what platform.  There are at least two
points at which you might redirect, one when the URL is first
requested (whether by entering or clicking on a link), and one when
something is about to be rendered.

The first seems the obvious one, but that crashes under Linux after a
few accesses for reasons that not even reasonably advanced (amateur)
Mozilla developers understand (and unfortunately the issue is too
obscure for any attention from the non-amateur Mozilla developers at
this time).  This was an issue whether using Xulrunner, or the 'fully
embedded' versions of Mozilla.  This showstopper issue is either much
less frequent or maybe even absent under Windows.

So depending on your target platform, you may be forced to do
something later in the process.  However, I have not been able to find
a complete list of the event sequences, and just guessing on the basis
of names leads to some surprising results.  Specifically, much
catching later in the process only happens *after* the browser has
actually accessed much of the content for the page you want to
redirect - it hasn't displayed it, but it has loaded it.  Or worse,
attempted to load something that is actually blocked, with the
attendant error messages which you must then also catch and suppress.

The bottom line at least as of late 2006 was that it was not possible
to get complete control of browser redirects using only the browser
itself.  In order to get something multiplatform, other more brute
force and incredibly ugly techniques completely outside the browser
were required to intercept calls from the browser and substitute other
content in its place.

If you are targeting Linux amongst your platforms, and want/need to
prevent the loading of to-be-redirected URL data even if not
displayed, you may need to look at other solutions.  OTOH, if you do
succeed in getting something working under Linux, that would be great
to let the world know how!  (it's many months since we went back and
attempted it with newer Xulrunner versions)

All the best...

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to