Relative paths in a Browser not working in RCP app [message #714603] |
Wed, 10 August 2011 23:36  |
Eclipse User |
|
|
|
I have a Browser widget in a view as part of my RCP application. I am using browser.setText(html) to load the content and within that content are <img> tags where the src is specified as a relative path using "../images/pic.jpg". This is not working and the image is not displayed.
The question is, where exactly does it think the current directory '.' is so that I can work out where it thinks '..' points to? If I use the system property to print out the current user directory and place the image in the "correct" relative path it still doesn't work. I use a similar relative path to access other resources such as a Lucene index from the same application and that is all working, it's just the links in the Browser that fail.
So, I guess the question is where does the Browser think the current working directory is? I can use relative paths in a static HTML page when it is displayed in a standard external web browser so I imagine this feature should be supported in the embedded Browser object right? The issue I suppose is that I am not loading the HTML using a URL but setting it directyly using setText().
Thanks,
-sbs
|
|
|
|
|
|
Re: Relative paths in a Browser not working in RCP app [message #715232 is a reply to message #714864] |
Fri, 12 August 2011 16:44  |
Eclipse User |
|
|
|
The <base> tag allows you to specify a location from which _subsequent_
relative paths will be computed, so it needs to be absolute.
Are you trying to reference image files that are shipped in a plug-in
jar? If so, eclipse core provides API for querying the absolute
location that a resource within a plug-in jar is auto-extracted to by
the platform. Or are you trying to accomplish something else?
Grant
On 8/11/2011 12:25 PM, SBS wrote:
> I have just discovered that the href in a <base> tag does not permit
> relative paths. Did I misinterpret the example, i.e. is there a
> different way of doing this that you were thinking of?
|
|
|
Powered by
FUDForum. Page generated in 0.04036 seconds