Results 1 to 8 of 8

Thread: [RESOLVED] style.css in webbrowser

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Posts
    101

    Resolved [RESOLVED] style.css in webbrowser

    I have one webbrowser and it isn't loading the .css of the page.. I set it to formload the index.html and inside the index.html I have entered the css inside the <style type="text/css">....</style> tags but then the browser only displays the html not the html formated by the style.


    Help please.
    Last edited by Acrobater; Mar 24th, 2011 at 04:14 PM.
    Thank you VB Forums!

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Posts
    101

    Re: style.css in webbrowser

    Anyone can help me please!
    Thank you VB Forums!

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: style.css in webbrowser

    How are you loading the page?

    Code:
    WebBrowser1.DocumentText =
    or

    Code:
    WebBrowser1.Url =
    Either way my bet is the browser can not resolve the path but if you had something like

    Code:
    WebBrowser1.Url = New Uri("http://kevininstructor.home.comcast.net/~kevininstructor/")
    The browser has a path to resolve the css files. That is my take.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Posts
    101

    Re: style.css in webbrowser

    vb Code:
    1. WebBrowser1.Url = New Uri("http://myaddress.com/index.htm")

    Didn't work :/
    Thank you VB Forums!

  5. #5
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: style.css in webbrowser

    Quote Originally Posted by Acrobater View Post
    vb Code:
    1. WebBrowser1.Url = New Uri("http://myaddress.com/index.htm")

    Didn't work :/
    What happens if you try
    Code:
    WebBrowser1.Url = New Uri("http://Google.com/")

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Posts
    101

    Re: style.css in webbrowser

    It loads ok. I also tried with other websites and they all loads the right way. I load mine on Mozilla and it loads the right way but once I add it to webbrowser it doesn't load the style.css :/ It only loads the images and the bg color, in IE it loads the same way as in vb.

    @EDIT:
    I have edited the HTML and now on IE it loads the right way but on webbrowser it won't load the right way :/

    ALso... The site is being made using iWebKit.
    Last edited by Acrobater; Mar 27th, 2011 at 05:17 PM.
    Thank you VB Forums!

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Posts
    101

    Re: style.css in webbrowser

    Please... help me please!!
    Thank you VB Forums!

  8. #8
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: style.css in webbrowser

    Quote Originally Posted by Acrobater View Post
    Please... help me please!!
    From what I mentioned before you can not get the web browser control to load an external css file if you are loading the HTML from a hard drive. In the attached project I show four different methods to load HTML and CSS.

    Code button works because the css is embedded
    Web button works because the web browser can resolve the css from the web.
    Disk 1 button fails because loading html from disk the web browser control can not resolve a path for the css.
    Disk 2 button works because the css in the html points to the same css in the web button code.

    Unless I am missing something these are your options
    Attached Files Attached Files

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