Web design and hosting, database, cloud and social media solutions that deliver business results
  • व्यापारिक समाधान
    • सॉफ़्टवेयर
    • रोबोटिक प्रक्रिया स्वचालन
    • डेटाबेस परामर्श सेवाएं
      • डेटा एकीकरण
      • डाटावेयरहाउस सेवाएं
      • पावर बीआई
      • सर्वर अपग्रेड और डीबीए सेवाएं
    • वेब साइट डिजाइन
      • भुगतान द्वार
      • लोगो डिजाइन
      • वेब स्थानीयकरण और अनुवाद
      • वेब साइट अनुकूलन
      • वेबसाइट सुरक्षा
      • तकनीकी उपकरण
    • क्लाउड समाधान
      • अमेज़न वेब सेवाएँ
      • Google क्लाउड सेवाएं
      • माइक्रोसॉफ्ट ऐज़ुर
    • माइक्रोसॉफ्ट ऑफिस
    • सामाजिक मीडिया
  • अकादमी
    • हमारा परीक्षण वातावरण
    • डेटाबेस डिजाइन सीखना
      • मूल बातें
      • SQL सर्वर Pivot-Unpivot का उपयोग करना
      • SQL सर्वर डेटा
      • SQL सर्वर फ़ंक्शंस का उपयोग करना
      • एसक्यूएल सर्वर 2008 रखरखाव योजनाएँ
      • एसक्यूएल सर्वर तिथियों का उपयोग करना
      • ओपन क्वेरी प्राप्त करें
    • वेबसाइट डिजाइन सीखना
      • Ousia सामग्री प्रबंधन प्रणाली का निर्माण
      • ASP-NET
      • CSS
      • जावास्क्रिप्ट का उपयोग करना
    • क्लाउड और आईटी सेवाएं सीखना
      • टास्क शेड्यूलर त्रुटि 2147943645
      • एसएसएल का अनुरोध करना और ओपनएसएसएल सरल चरणों में पीएफएक्स फ़ाइल बनाना
    • सामाजिक मीडिया का उपयोग
      • Google समीक्षा के लिए पूछना
      • फेसबुक अकाउंट को पर्सनल से बिजनेस में बदलना
      • सोशल मीडिया छवि आकार
      • सोशल मीडिया छवियाँ सेट करने के लिए मेटा डेटा का उपयोग करना
      • सोशल मीडिया प्रयासों पर ध्यान केंद्रित करने का स्थान चुनना
  • हमारे बारे में
    • ब्लॉग
      • Google कोर अपडेट जनवरी 2020
      • अपनी वेबसाइट के लिए सामग्री का चुनाव कैसे करें विज्ञापन पत्रक
      • इंटरनेट पर वेबसाइटों के बारे में सबसे कष्टप्रद बातें
      • एक प्रवेश स्तर की गेमिंग मशीन का निर्माण
      • ऑनलाइन घोटाले को रोकना
      • गिग इकॉनमी के स्किमर्स
      • मुफ्त वेक्टर ग्राफिक्स के लिए शीर्ष 5 वेबसाइटें
      • गर्म मिर्च इंटरनेट बंद
    • करियर
      • अनुवादक अंग्रेज़ी-जापानी
      • अनुवादक अंग्रेज़ी-तुर्की
      • अनुवादक अंग्रेज़ी-पुर्तगाली
      • अनुवादक अंग्रेज़ी-स्पेनिश
    • टीम
      • अली अल अमीन
      • ऐसे हुरो
      • एड्रियन आनंदन
      • गेविन क्लेटन
      • चेस्टर कॉपरपॉट
      • सुनील कुमार
      • सूर्य मुक्कमल
      • साई गंगू
    • नियामक
    • पोर्टफोलियो
Deutsch (DE)English (EN-US)English (EN-GB)हिंदी (HI)italiano (IT)日本語 (JA)Türk (TR)

मोबाइल और डेस्कटॉप विकास के लिए एक या अलग साइटों का उपयोग करना

मोबाइल और डेस्कटॉप विकास के लिए एक या अलग साइटों का उपयोग करना।

Use responsive CSS if possible.

I've been spending time looking at the ongoing battles between developers over one of the fundamental headaches of web design, should you build separate sites for mobile devices and desktop computers. Some of the changes that Google have introduced like syncing your bookmarks for the IPhone and Chrome are really useful, this has led me to the single site conclusion, but a lot the code below could be used to redirect to a seperate site.

The site should be easy enough to use on either, while you can turn some things on or off with some simple detection.

There is also a cookie stored on the users device that remembers the last option selected.

This is what the detection does on this site. It is a simple dropdown with three options; Desktop, Apple and Mobile. There is also a dual menu system, which offers a simplified breadcrumb for the user as well.

HTML

<asp:DropDownList ID="SelDevice" runat="server" ClientIDMode="Static" Width="100px" AutoPostBack="True">

    <asp:ListItem>Desktop</asp:ListItem>

    <asp:ListItem>Apple</asp:ListItem>

    <asp:ListItem>Mobile</asp:ListItem>

</asp:DropDownList>

<div id="SubMenu">

    <div id="Current" runat="server" clientidmode="Static"></div>

    <div id="SubMenuList" runat="server" clientidmode="Static"></div>

</div>

Now this code is used in the Page Load event, setting the linked style sheet before rendering on the page. You could also for instance change the visibility of certain items within the If statement.
LoaderVBC#

VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    If Session("View") Is Nothing Then        If Request.Cookies("ViewType") Is Nothing Then            If Request.Browser.IsMobileDevice = True Then                Dim ua As String = Request.UserAgent.ToString().ToLower()                If ua.Contains("iphone") Or ua.Contains("ipad") Or ua.Contains("ipod") Then                    Session("View") = "Apple"                Else                    Session("View") = "Mobile"                End If            Else                Session("View") = "Desktop"            End If        Else            Session("View") = Request.Cookies("ViewType").Value.ToString        End If    End If    SelDevice.SelectedValue = Session("View").ToString    If Session("View").ToString = "Apple" Then        cssLink.Href = "/gsclaytonmob.css"    ElseIf Session("View").ToString = "Mobile" Then        cssLink.Href = "/gsclaytonmobold.css"    Else        cssLink.Href = "/gsclayton2.css"    End If    GetMenus()End Sub

C#

protected void Page_Load(object sender, EventArgs e){    if (Session("View") == null)    {        if (Request.Cookies("ViewType") == null)        {            if (Request.Browser.IsMobileDevice == true)            {                string ua = Request.UserAgent.ToString().ToLower();                if (ua.Contains("iphone") | ua.Contains("ipad") | ua.Contains("ipod"))                {                    Session("View") = "Apple";                }                else                {                    Session("View") = "Mobile";                }            }            else            {                Session("View") = "Desktop";            }        }        else        {            Session("View") = Request.Cookies("ViewType").Value.ToString;        }    }    SelDevice.SelectedValue = Session("View").ToString;    if (Session("View").ToString == "Apple")    {        cssLink.Href = "/gsclaytonmob.css";    }    else if (Session("View").ToString == "Mobile")    {        cssLink.Href = "/gsclaytonmobold.css";    }    else    {        cssLink.Href = "/gsclayton2.css";    }    GetMenus();}
In the code above you would replace the setting of CSS with a redirect.
We will need some code to recognise that the user has changed their view type. We will also stored a cookie here to remember the value next time they access the site.
LoaderVBC#

VB

Protected Sub SelDevice_SelectedIndexChanged(sender As Object, e As EventArgs) Handles SelDevice.SelectedIndexChanged    Session("View") = SelDevice.SelectedValue    Response.Cookies("ViewType").Value = Session("View")    Response.Cookies("ViewType").Expires = DateTime.Now.AddDays(1000)    If Session("View").ToString = "Apple" Then        cssLink.Href = "/gsclaytonmob.css"    ElseIf Session("View").ToString = "Mobile" Then        cssLink.Href = "/gsclaytonmobold.css"    Else        cssLink.Href = "/gsclayton2.css"    End If    GetMenus()End Sub

C#

protected void SelDevice_SelectedIndexChanged(object sender, EventArgs e){    Session("View") = SelDevice.SelectedValue;    Response.Cookies("ViewType").Value = Session("View");    Response.Cookies("ViewType").Expires = DateTime.Now.AddDays(1000);    if (Session("View").ToString == "Apple")    {        cssLink.Href = "/gsclaytonmob.css";    }    else if (Session("View").ToString == "Mobile")    {        cssLink.Href = "/gsclaytonmobold.css";    }    else    {        cssLink.Href = "/gsclayton2.css";    }    GetMenus();}
Once the menu type has been set we can also populate the menu manually in code behind, adding the references dependant on the menu provided.
LoaderVBC#

VB

Protected Sub GetMenus()    Dim m As String = Page.RouteData.Values("PageMenu")    Select Case m        Case "Home"            'HomeSubMenu.Attributes.CssStyletyle = "Active"            Current.InnerHtml = "Home"            Dim a As New HyperLink            a.NavigateUrl = "Home/"            a.Text = "Home"            SubMenuList.Controls.Add(a)            Dim b As New HyperLink            b.NavigateUrl = "About/"            b.Text = "About"            SubMenuList.Controls.Add(b)            Dim c As New HyperLink            c.NavigateUrl = "Login/"            c.Text = "Login"            SubMenuList.Controls.Add(c)    End SelectEnd Sub

C#

protected void GetMenus(){    string m = Page.RouteData.Values("PageMenu");    switch (m)    {        case "Home":            //HomeSubMenu.Attributes.CssStyletyle = "Active"            Current.InnerHtml = "Home";            HyperLink a = new HyperLink();            a.NavigateUrl = "Home/";            a.Text = "Home";            SubMenuList.Controls.Add(a);            HyperLink b = new HyperLink();            b.NavigateUrl = "About/";            b.Text = "About";            SubMenuList.Controls.Add(b);            HyperLink c = new HyperLink();            c.NavigateUrl = "Login/";            c.Text = "Login";            SubMenuList.Controls.Add(c);            break;    }}

You can then style each of the Menus differently in your CSS, for example each of the links in my Sub Menu area are styled differently. The first one is for mobile (full width), and the second for desktop.

CSS

#SubMenu a{color: #332700;float: left;width: 100%;display: block;text-decoration: none;padding: 5px 0px 5px 0px;font-size: large;border-bottom: 1px solid Grey;}#SubMenu a{color: #45144D;padding-left: 8px;float: right;text-decoration: none;}

Author

Helpful?

Please note, this commenting system is still in final testing.

क्लेटाबेस द्वारा वेबसाइट डिजाइन

यह कोड का एक भाग है जिसे Ousia सामग्री प्रबंधन प्रणाली कोड से संशोधित किया गया है, जो बाजार पर सबसे तेज और सबसे अनुकूलित प्रणालियों में से एक है, जो हमारी वेबसाइट डिजाइन सेवाओं का हिस्सा है।

ये लगभग £500 से शुरू होने वाली साइटों के साथ उपलब्ध हैं।

हम रिस्पॉन्सिव CSS का उपयोग करने की सलाह देते हैं जैसा कि हम अपने सिस्टम में करते हैं।

अधिक: उत्तरदायी और तेज। सामग्री प्रबंधन प्रणाली के साथ वेब विकास, डिजाइन और होस्टिंग
Copyright Claytabase Ltd 2020

Registered in England and Wales 08985867

RSSLoginLink कूकी नीतिसाइटमैप

Social Media

facebook.com/Claytabaseinstagram.com/claytabase/twitter.com/Claytabaselinkedin.com/company/claytabase-ltd

Get in Touch

+442392064871info@claytabase.comClaytabase Ltd, Unit 3d, Rink Road Industrial Estate, PO33 2LT, United Kingdom
इस साइट की सेटिंग्स सभी कुकीज़ को अनुमति देने के लिए सेट हैं इन्हें हमारी कुकी नीति और सेटिंग पृष्ठ पर बदला जा सकता है। इस साइट का उपयोग जारी रखने के द्वारा आप कुकीज़ के उपयोग से सहमत हैं।
Ousia Logo
Logout
Ousia CMS Loader