How to set Delphi WebBrowser Base directory different that HTML location
        Posted  
        
            by Steve
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Steve
        
        
        
        Published on 2010-04-21T21:41:51Z
        Indexed on 
            2010/04/21
            21:43 UTC
        
        
        Read the original article
        Hit count: 349
        
delphi
|twebbrowser
I have a Delphi program that creates HTML files. Later when a button is pressed a TWebBrowser is created and a WebBrowser.Navigate causes the html page to display.
Is there anyway to set the WebBrowser "default directory" so it will always be the location of the Delphi executable not the HTML file?
I do not want to set the Base value in the HTML to a hardcoded value because then when the HTML is ran from another Delphi exe they are not found.
for example:
if the exe is run from D:\data\delphi\pgm.exe then the base location D:\data\delphi\ and the jpgs are at D:\data\delphi\jpgs\
but if the exe is run from: C:\stuff\pgm.exe i want the base location to be C:\stuff\ and the jpgs to be at C:\stuff\jpgs\
So I cannot write a line in the HTML with the base location since when it is ran from another exe it would point to wrong location for that exe.
So I either need to set the base location when I create the webbrowser and before I read the HTML or I need a way to pass into the webbrowser the location where I can then set the base location.
Sorry for being so long-winded but I could not figure out how to saw what I needed.
© Stack Overflow or respective owner