संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
मोबाइल डिवाइस के लिए वेब पेज और ऐप्लिकेशन डेवलप करने में, मॉडल बनाने में अलग-अलग चुनौतियां आती हैं.
डेस्कटॉप वेब ब्राउज़र के लिए वेब पेज डेवलप करने तक का काम करते हैं. नीचे दिए गए तरीकों की मदद से,
Android और अन्य मोबाइल डिवाइसेस के लिए सबसे प्रभावी वेब ऐप्लिकेशन है.
मोबाइल डिवाइसों को अपनी वेबसाइट के लिए खास तौर पर बनाए गए मोबाइल वर्शन पर रीडायरेक्ट करें. कई
ऐसा करने के लिए सर्वर-साइड रीडायरेक्ट का इस्तेमाल करता है. एक सामान्य तरीका है "स्निफ़" यह
वेब ब्राउज़र से मिली उपयोगकर्ता एजेंट स्ट्रिंग. तय करने के लिए
आपकी साइट का मोबाइल वर्शन दिखाना है या नहीं, तो "मोबाइल" उपयोगकर्ता एजेंट की स्ट्रिंग.
HTML5 का इस्तेमाल करें
का भी इस्तेमाल किया जा सकता है. HTML5, मोबाइल वेबसाइटों के लिए इस्तेमाल की जाने वाली सबसे सामान्य मार्कअप भाषा है.
यह मानक, मोबाइल को प्राथमिकता देने वाले डेवलपमेंट को बढ़ावा देता है, ताकि यह पक्का किया जा सके कि वेबसाइटें अलग-अलग तरह के डिवाइसों पर काम करें
डिवाइस. पिछली वेब भाषाओं के उलट, HTML5 आसान <DOCTYPE> और
charset एलान:
<!DOCTYPEhtml>
...
<metacharset="UTF-8">
अपने वेब पेज का साइज़ सही तरीके से बदलने के लिए, व्यूपोर्ट मेटाडेटा का इस्तेमाल करें. आपके दस्तावेज़ में
<head> में ऐसा मेटाडेटा शामिल करें जिससे यह पता चलता हो कि आपको ब्राउज़र के व्यूपोर्ट को कैसा दिखाना है
अपने वेब पेज को रेंडर करने में मदद मिलती है. उदाहरण के लिए, आपका व्यूपोर्ट मेटाडेटा,
ब्राउज़र का व्यूपोर्ट, शुरुआती पेज स्केल, और टारगेट स्क्रीन की सघनता.
यहां दिए गए उदाहरण में, व्यूपोर्ट मेटाडेटा को सेट करने का तरीका बताया गया है:
वर्टिकल लीनियर लेआउट का इस्तेमाल करें. स्क्रीन पर सबसे ऊपर बाईं और दाईं ओर स्क्रोल करने की ज़रूरत नहीं होती
नेविगेट करना. उपयोगकर्ता के लिए ऊपर और नीचे स्क्रोल करना आसान होता है और इससे आपका पेज ज़्यादा आसान हो जाता है.
लेआउट की ऊंचाई और चौड़ाई को match_parent पर सेट करें. सेट किया जा रहा है
WebView ऑब्जेक्ट की ऊंचाई और चौड़ाई
match_parent यह पक्का करता है कि आपके ऐप्लिकेशन के व्यू का साइज़ सही हो. हम यह सुझाव नहीं देते हैं कि
ऊंचाई wrap_content तक सेट करें, क्योंकि इसका साइज़ गलत है. इसी तरह, सेटिंग में
लेआउट की चौड़ाई wrap_content तक काम नहीं करती. इसकी वजह से आपका WebView
इसके बजाय इसकी पैरंट चौड़ाई का इस्तेमाल करें. इस व्यवहार की वजह से, यह पक्का करना भी ज़रूरी है कि
आपके WebView ऑब्जेक्ट के पैरंट लेआउट ऑब्जेक्ट में से, ऊंचाई और चौड़ाई को इस पर सेट किया गया है
wrap_content.
एक से ज़्यादा फ़ाइल अनुरोध करने से बचें. मोबाइल डिवाइस में आम तौर पर कनेक्शन स्पीड होती है
डेस्कटॉप कंप्यूटर की तुलना में धीमा, अपने पेज को जल्द से जल्द लोड करें. उसकी रफ़्तार बढ़ाने का एक तरीक़ा यह है कि
कृपया <head> में स्टाइलशीट और स्क्रिप्ट फ़ाइलों जैसी अतिरिक्त फ़ाइलों को लोड होने से रोकें.
साथ ही, इन बातों पर ध्यान दें
की मदद से मोबाइल विश्लेषण किया जा सकता है
Google के PageSpeed Insights टूल का इस्तेमाल करके, खास तौर पर आपके ऐप्लिकेशन के लिए बेहतर ऑप्टिमाइज़ेशन से जुड़े सुझाव पाएं.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Best practices for web apps\n\nDeveloping web pages and applications for mobile devices presents different challenges compared\nto developing a web page for desktop web browsers. The following practices can help you provide the\nmost effective web application for Android and other mobile devices.\n\n1. **Redirect mobile devices to a dedicated mobile version of your website.** There are several ways to do this using server-side redirects. One common method is to \"sniff\" the User Agent string provided by the web browser. To determine whether to serve a mobile version of your site, look for the \"mobile\" string in the User Agent.\n| **Note:** Large-screen Android-powered devices that are served full-size websites---such as tablets---don't include the \"mobile\" string in the User Agent, while the rest of the User Agent string is mostly the same. As such, it's important you deliver the mobile version of your website based on whether the \"mobile\" string exists in the User Agent.\n2. **Use [HTML5](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5)\n for mobile devices.** HTML5 is the most common markup language used for mobile websites. This standard encourages mobile-first development to help ensure that websites work on a variety of devices. Unlike previous web languages, HTML5 uses simpler `\u003cDOCTYPE\u003e` and `charset` declarations: \n\n ```xml\n \u003c!DOCTYPE html\u003e\n ...\n \u003cmeta charset=\"UTF-8\"\u003e\n ```\n3. **Use viewport metadata to properly resize your web page.** In your document `\u003chead\u003e`, provide metadata that specifies how you want the browser's viewport to render your web page. For example, your viewport metadata can specify the height and width for the browser's viewport, the initial page scale, and the target screen density.\n\n The following example shows how to set viewport metadata: \n\n ```xml\n \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"\u003e\n ```\n\n For more information about how to use viewport metadata for Android-powered devices, read [Support different screens in web apps](/guide/webapps/targeting).\n4. **Use a vertical linear layout.** Avoid the need for the user to scroll left and right while navigating your page. Scrolling up and down is easier for the user and makes your page simpler.\n5. **Set the layout height and width to `match_parent`.** Setting your [`WebView`](/reference/android/webkit/WebView) object's height and width to `match_parent` makes sure your app's views are sized correctly. We discourage setting the height to `wrap_content` because it results in incorrect sizing. Similarly, setting the layout width to `wrap_content` isn't supported and causes your `WebView` to use the width of its parent instead. Because of this behavior, it's also important to make sure none of your `WebView` object's parent layout objects have their height and width set to `wrap_content`.\n6. **Avoid multiple file requests.** Because mobile devices typically have a connection speed slower than desktop computers, make your page load as fast as possible. One way to speed it up is to avoid loading extra files such as stylesheets and script files in the `\u003chead\u003e`. Also, consider [performing mobile analysis with\n Google's PageSpeed Insights](https://developers.google.com/speed/docs/insights/v5/get-started) for detailed optimization suggestions specific to your app.\n\nAdditional resources\n--------------------\n\n- [Pixel-Perfect UI in the WebView](https://developers.google.com/chrome/mobile/docs/webview/pixelperfect)\n- [Learn Responsive Design](http://www.html5rocks.com/en/mobile/responsivedesign/)\n- [High DPI images for variable pixel densities](http://www.html5rocks.com/en/mobile/high-dpi/)\n- [Mobile Web Best Practices](http://www.w3.org/TR/mobile-bp/)\n- [Make the Web Faster](https://developers.google.com/speed/overview)"]]