Results 1 to 4 of 4

Thread: WebBrowser control - design mode - relative paths

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    774

    WebBrowser control - design mode - relative paths

    Is there any way to get the WebBrowser control (in design mode) to show images which are referenced with a relative path, such as this:

    HTML Code:
    <IMG src='page1_files/image1.jpg'>
    If I use an absolute path it works fine:

    HTML Code:
    <IMG src='file:///C:/Users/Paul/AppData/Local/Web_Editor/page1_files/image1.jpg'>
    Is it possible to tell the WebBrowser the "starting location" when using relative paths?

    (I have just about finished converting all src locations by manipulating strings, but it just occurred to me I might have missed an easier way!)
    Last edited by paulg4ije; Jan 1st, 2013 at 07:32 AM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    774

    Re: WebBrowser control - design mode - relative paths

    After a bit more Googling ... it seems that using the WebBrowser control as an editor effectively navigates to about:blank and you can't reference files from there. There doesn't seem to be any kind of "default directory" property that you can use a starting point for relative paths.

    Still open to other suggestions though ...

  3. #3
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: WebBrowser control - design mode - relative paths

    Balderdash! (I've always wanted to say that on this forum!) If it navigated to about:blank then you wouldn't be able to see the document you're editing! The reason you can't reference files is that the HTML is not being interpreted the same way that it is when you navigate to a page. That's kinda what design mode means!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    774

    Re: WebBrowser control - design mode - relative paths

    It's a shame there isn't a property to define the "starting directory" when in design mode. Lots of people in Google-land looking for the same thing as me. Anyway, I've managed to do the necessary with string manipulation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width