<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aniket Batabyal</title>
    <description>The latest articles on DEV Community by Aniket Batabyal (@anarchymonkey).</description>
    <link>https://dev.to/anarchymonkey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F569062%2F7cfb90ce-a99b-4180-8596-bda278d27677.jpeg</url>
      <title>DEV Community: Aniket Batabyal</title>
      <link>https://dev.to/anarchymonkey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anarchymonkey"/>
    <language>en</language>
    <item>
      <title>Navigate Your Way Through Web Development</title>
      <dc:creator>Aniket Batabyal</dc:creator>
      <pubDate>Wed, 15 Feb 2023 05:21:36 +0000</pubDate>
      <link>https://dev.to/anarchymonkey/navigate-your-way-through-web-development-55ei</link>
      <guid>https://dev.to/anarchymonkey/navigate-your-way-through-web-development-55ei</guid>
      <description>&lt;p&gt;&lt;em&gt;The Power of JavaScript’s Navigator Object&lt;/em&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;"Have you ever gone on a treasure hunt? Sometimes, you need a map to find your treasure. A navigator in JavaScript is like a map for your computer. It helps your computer find things on the internet, like websites and pictures. It’s like a guide that shows your computer where to go!”&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What the hell is a navigator?
&lt;/h2&gt;

&lt;p&gt;The navigator object is a built-in object in JavaScript that provides information about the user’s web browser and operating system. This object is available in all modern web browsers, including Google Chrome, Mozilla Firefox, and Microsoft Edge.&lt;/p&gt;

&lt;p&gt;Some of the most common properties and methods of the navigator object include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;userAgent&lt;/strong&gt;: This property returns a string that contains information about the user’s web browser, such as its name and version.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(navigator.userAgent);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;platform&lt;/strong&gt;: This property returns a string that describes the user’s operating system, such as Windows or macOS.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(navigator.platform);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;cookieEnabled&lt;/strong&gt;: This property returns a Boolean value indicating whether or not the user’s web browser is set up to accept cookies.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Cookies enabled: " + navigator.cookieEnabled);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;geolocation&lt;/strong&gt;: This property provides access to the user’s current location, if the user has granted permission to access their geolocation.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;navigator.geolocation.getCurrentPosition(function(position) {
  console.log("Latitude: " + position.coords.latitude);
  console.log("Longitude: " + position.coords.longitude);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;language&lt;/strong&gt;: This property returns a string that specifies the user’s preferred language for web content.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// languages: gives all of the supported languages (list)
// language: give the current set language
console.table({ languages: navigator.languages, language: navigator.language})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;screen&lt;/strong&gt;: This will display the dimensions of the user’s screen, in pixels.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Screen resolution: " + screen.width + "x" + screen.height);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.A &lt;code&gt;Navigator&lt;/code&gt; object can be retrieved using the read-only &lt;code&gt;window.navigator&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;The most common uses are in service workers &amp;amp; to check if the internet connection is available or not.&lt;/p&gt;

&lt;p&gt;P.S: check out &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdeveloper.mozilla.org%2Fmdn-social-share.d893525a4fb5fb1f67a2.png" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator" rel="noopener noreferrer" class="c-link"&gt;
          Navigator - Web APIs | MDN
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdeveloper.mozilla.org%2Ffavicon.ico" width="48" height="48"&gt;
        developer.mozilla.org
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;(SUPRISE!!)&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
