{"id":796,"date":"2012-06-24T13:52:37","date_gmt":"2012-06-24T20:52:37","guid":{"rendered":"http:\/\/virendrachandak.wordpress.com\/?p=796"},"modified":"2014-12-12T08:43:46","modified_gmt":"2014-12-12T16:43:46","slug":"get-various-parts-url-using-javascript","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/","title":{"rendered":"Get various parts of URL using JavaScript"},"content":{"rendered":"<p>Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using regular expressions etc. to get the domain name. I was able to get the required information using this method, but then I thought that this is something for which there should be an easier way, and indeed there is an easier way.<\/p>\n<p>We can use the Location Object to get all the various parts of the URL. (e.g. window.location.href to get the entire URL)<\/p>\n<p><strong>Note<\/strong>: There is no public standard that applies to the location object, but all major browsers support it.<br \/>\n<!--more--><br \/>\nA URL may consists of as many as 6 parts. My previous blog post &#8220;<a href=\"http:\/\/www.virendrachandak.com\/techtalk\/\/parts-of-url\/\" title=\"Parts of URL\">Parts of URL<\/a>&#8221; explains the different parts of a URL. <\/p>\n<p>Now, we will see how we can get all these different parts of the URL using the Location object. We can use the different properties of the Location object to get all the parts. <\/p>\n<table>\n<tr>\n<th>Property<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>hash<\/td>\n<td>Returns anchor portion of the URL, including the leading hash. (&#8220;#results&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>host<\/td>\n<td>Returns the hostname and port (if available) of a URL. (&#8220;www.example.com&#8221; or &#8220;www.example.com:80&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>hostname<\/td>\n<td>Returns the hostname portion of the URL (&#8220;www.example.com&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>href<\/td>\n<td>Returns the entire URL. (&#8220;http:\/\/www.example.com:80\/example.php?x=1&amp;y=2#results&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>pathname<\/td>\n<td>Returns the path name of the URL (&#8220;\/example.php&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>port<\/td>\n<td>Returns the port portion of the URL (&#8220;80&#8221; within the host &#8220;www.example.com:80&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>protocol<\/td>\n<td>Returns the protocol portion of the URL, including the trailing colon (&#8220;http:&#8221;, &#8220;https:&#8221;, &#8220;ftp:&#8221;, etc)<\/td>\n<\/tr>\n<tr>\n<td>search<\/td>\n<td>Returns the query portion of the URL, including the question mark (&#8220;?x=1&amp;y=2&#8221;)<\/td>\n<\/tr>\n<\/table>\n<div style=\"padding-top:30px;\">\n<p><strong>Related Articles<\/strong>:<\/p>\n<ul>\n<li><a title=\"Location\" href=\"http:\/\/www.javascriptkit.com\/jsref\/location.shtml\" rel=\"external nofollow\" target=\"_blank\">Location<\/a><\/li>\n<li><a title=\"The Location Object\" href=\"http:\/\/www.w3schools.com\/jsref\/obj_location.asp\" rel=\"external nofollow\" target=\"_blank\">The Location Object<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using regular expressions etc. to get the domain name. I was able to get the required information using this method, but then I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[144,8],"tags":[124,71],"class_list":["post-796","post","type-post","status-publish","format-standard","hentry","category-javascript","category-web-development","tag-snippets","tag-url-parts"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get various parts of URL using JavaScript - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get various parts of URL using JavaScript - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-24T20:52:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-12-12T16:43:46+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"Get various parts of URL using JavaScript\",\"datePublished\":\"2012-06-24T20:52:37+00:00\",\"dateModified\":\"2014-12-12T16:43:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/\"},\"wordCount\":301,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"snippets\",\"URL Parts\"],\"articleSection\":[\"JavaScript\",\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/\",\"name\":\"Get various parts of URL using JavaScript - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2012-06-24T20:52:37+00:00\",\"dateModified\":\"2014-12-12T16:43:46+00:00\",\"description\":\"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/get-various-parts-url-using-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Get various parts of URL using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get various parts of URL using JavaScript - Virendra&#039;s TechTalk","description":"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Get various parts of URL using JavaScript - Virendra&#039;s TechTalk","og_description":"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2012-06-24T20:52:37+00:00","article_modified_time":"2014-12-12T16:43:46+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"Get various parts of URL using JavaScript","datePublished":"2012-06-24T20:52:37+00:00","dateModified":"2014-12-12T16:43:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/"},"wordCount":301,"commentCount":2,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["snippets","URL Parts"],"articleSection":["JavaScript","Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/","name":"Get various parts of URL using JavaScript - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2012-06-24T20:52:37+00:00","dateModified":"2014-12-12T16:43:46+00:00","description":"Recently I wanted to get a domain name of the page on which I was currently on. I was trying to parse the entire URL of the page and then parse it using","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/get-various-parts-url-using-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Get various parts of URL using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-cQ","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":803,"url":"https:\/\/www.virendrachandak.com\/techtalk\/parts-of-url\/","url_meta":{"origin":796,"position":0},"title":"Parts of URL","author":"Virendra Chandak","date":"May 26, 2012","format":false,"excerpt":"We see so many URLs everyday, but do we know what are the parts of an URL, what does each part means? In this post I will discuss the various parts of the URL. An URL may consists of as many as 6 parts. The different parts of the URL\u2026","rel":"","context":"In &quot;Glossary\/Definitions&quot;","block_context":{"text":"Glossary\/Definitions","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/glossarydefinitions\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":699,"url":"https:\/\/www.virendrachandak.com\/techtalk\/get-search-query-string-from-search-engines-using-php\/","url_meta":{"origin":796,"position":1},"title":"Get search query string from search engines using PHP","author":"Virendra Chandak","date":"February 4, 2012","format":false,"excerpt":"I have often come across situations when I would like to implement some functionality based on what the user searched for in a search engine like Google, Bing etc. The search query string is normally passed as GET variables 'q' or 'query'. The function below will return the search query\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2287,"url":"https:\/\/www.virendrachandak.com\/techtalk\/async-vs-defer\/","url_meta":{"origin":796,"position":2},"title":"How to remove render blocking JavaScript with defer and async","author":"Virendra Chandak","date":"January 14, 2019","format":false,"excerpt":"With HTML5 there are 2 new boolean attributes for <script> tag which indicates to the browser how the script should be evaluated. The 2 attributes are defer and async. Using these attributes can help improve the page load time by downloading the script in parallel when the page is being\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/javascript\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":117,"url":"https:\/\/www.virendrachandak.com\/techtalk\/optimizing-websites\/","url_meta":{"origin":796,"position":3},"title":"Optimizing \/ Speeding up websites","author":"Virendra Chandak","date":"April 14, 2011","format":false,"excerpt":"In this article I will list a few things that can be done to speed up website. I will give just brief description on each topic and give links to find more details on those topics. I have used tools like Google's Page Speed, YSlow, Audits Tab in Chrome\u00a0Developer\u00a0Tools. 1.\u2026","rel":"","context":"In &quot;Optimization Tips&quot;","block_context":{"text":"Optimization Tips","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/optimization-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":572,"url":"https:\/\/www.virendrachandak.com\/techtalk\/migrating-servers-using-dns-ttl-for-minimum-downtime\/","url_meta":{"origin":796,"position":4},"title":"Migrating servers using DNS TTL for minimum downtime","author":"Virendra Chandak","date":"December 17, 2011","format":false,"excerpt":"You have your site running on an old hardware and want to migrate it to a new upgraded hardware which would result in change of the ipaddress of your site and in turn imply downtime for your site. You want to minimize the downtime due to the change in ipaddress.\u2026","rel":"","context":"In &quot;Optimization Tips&quot;","block_context":{"text":"Optimization Tips","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/optimization-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1023,"url":"https:\/\/www.virendrachandak.com\/techtalk\/protocol-relative-urls\/","url_meta":{"origin":796,"position":5},"title":"Protocol relative URLs","author":"Virendra Chandak","date":"October 7, 2014","format":false,"excerpt":"Many times we have seen warnings similar to \"This page contains both secure and nonsecure items\" or \"This page has insecure content.\". This happens when we are viewing a HTTPS site and some content on the site is loaded from HTTP. So when we try to view a site say\u2026","rel":"","context":"In &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=796"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/796\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}