How Creat Site With Supporte all Browser?

Last post 07-07-2009 5:12 PM by Bobby-Z. 1 replies.

Sort Posts:

  • How Creat Site With Supporte all Browser?

    07-07-2009, 9:05 AM

     I creat site with ASP.Net (c#) but only with IE7 Supported

    How can creat site which support with all browsers?

  • Re: How Creat Site With Supporte all Browser?

    07-07-2009, 5:12 PM
    Answer
    • Member
      648 point Member
    • Bobby-Z
    • Member since 10-04-2008, 5:53 AM
    • Orange County, CA
    • Posts 284

     Well there are several ways:

    1. create Stylesheets for each different type of browser

    2. Download and Test your site with each browser

    3. use javascript to detect the broswer and use the proper stylesheet

    4. System.Web.HTTPBroswerCapabilities to detect browser and use proper stylesheet

    example: on the PreRender Event

    Dim Browser As System.Web.HttpBrowserCapabilities = Request.Browser
    
    Dim CSS As System.Web.UI.Html.Link = Me.Master.FindControl("CSS")
    CSS.Href = "../CSS/" + Browser.Type + ".css"
    


    Then on your page you need to add to your link for your stylesheet

    <link id="CSS" runat="server" href="../CSS/Page.css" rel="stylesheet" type="text/css" />


    You may need to find out what the code calls the broswer type (IE7) I know

    http://msdn.microsoft.com/en-us/library/3yekbd5b(VS.80).aspx

    So if you have a Stylesheet designed for IE7 then name it IE7.css and the above code (VB) will detect and load the proper stylesheet (this code is also for a content page to change the css of a masterpage)

    You also can't go wrong if you use tables instead of divs for layout- regardless of what they all say CSS tables are going to be used more prevalently in the future as broswers don't screw them up as much as divs. It seems a div that is 500px in IE7 is not 500px in Safari?? Who knew.

     

    "Success is the Sum of Small Efforts, Repeated Day in and Day Out - Without Ceasing!"

    Robert Hall
    CEO and Founder
    My Service Solutions, Inc.
Page 1 of 1 (2 items)