{"id":28236,"date":"2016-10-18T23:01:33","date_gmt":"2016-10-18T15:01:33","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=28236"},"modified":"2025-04-04T02:49:00","modified_gmt":"2025-04-03T18:49:00","slug":"make-bookmarklet-with-javascript","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/","title":{"rendered":"How to Create a Text-Search Bookmarklet with JavaScript"},"content":{"rendered":"<p><strong>Bookmarklets<\/strong> are <strong>JavaScript applications<\/strong> that can be accessed as <strong>browser bookmarks<\/strong>. They are used to enable users to <strong>perform different actions<\/strong> on web pages. For instance, this <a href=\"https:\/\/webfonter.fontshop.com\/#threeways-section\" target=\"_blank\" rel=\"noopener\">bookmarklet by FontShop<\/a> is for previewing FontShop web fonts on any web page.<\/p>\n<p>In this article, we are going to see how quick and easy it is to <strong>concoct a bookmarklet<\/strong> by creating one that <strong>performs a <a href=\"https:\/\/www.wikiwand.com\/\" target=\"_blank\" rel=\"noopener nofollow\">Wikiwand<\/a><\/strong> (better-looking Wikipedia) <strong>search<\/strong> for a selected text on any web page.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/100-useful-bookmarklets-for-better-productivity-ultimate-list\/\">50 Bookmarklets For Better Productivity<\/a>\n\t\t\t\t<\/p>\n<h2>How bookmarklets work<\/h2>\n<p>The URI of a bookmarklet <strong>uses the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/aa767736(v=vs.85).as\" target=\"_blank\" rel=\"noopener\"><code>javascript:<\/code> protocol<\/a><\/strong> that indicates it\u2019s <strong>composed of JavaScript code<\/strong>. When you click on a bookmarklet, you can <strong>run JavaScript<\/strong> on a web page, and  perform tasks, such as changing the appearance of a page, redirecting to another page, or showing new information on it.<\/p>\n<p>Since bookmarks are essentially <strong>sets of JavaScript code<\/strong>, they are easy to create with little JavaScript knowledge, either for personal use or for offering it to your users, such as WordPress does with its <a href=\"https:\/\/codex.wordpress.org\/Press_This\" target=\"_blank\" rel=\"noopener\">Press This<\/a> bookmarklet.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/wordpress-press-this\/\">Boost Your Blog with \u2018Press This\u2019 Bookmarklet: Reblogging Made Easy<\/a>\n\t\t\t\t<\/p>\n<h2>Get started with the JavaScript code<\/h2>\n<p>The <strong>URL structure<\/strong> Wikiwand uses for an English-language article is <code>https:\/\/www.wikiwand.com\/en\/articleTitle<\/code>. We need to write a script that jumps to the Wikiwand page of which URL <strong>ends with the string the user has just selected<\/strong> \u2014 the selected text will need to <strong>be put in place of <code>articleTitle<\/code><\/strong>.<\/p>\n<p>First, we <strong>get hold of the text<\/strong> the user has selected on the page with the following code:<\/p>\n<pre>\r\ngetSelection().toString()\r\n<\/pre>\n<p>We need to <strong>cast<\/strong> the object returned by <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Window\/getSelection\" target=\"_blank\" rel=\"noopener\"><code>getSelection()<\/code><\/a> <strong>as a string<\/strong> by using the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/toString\" target=\"_blank\" rel=\"noopener\"><code>toString()<\/code><\/a> method, in order to make it <strong>output the selected text<\/strong>.<\/p>\n<p>Next, we need to <strong>perform a visit<\/strong> to the Wikiwand article page. We\u2019ll achieve this by using the following logic, where <code>newURL<\/code> will be the <strong>URL of the Wikiwand article page<\/strong> (that will contain the selected string at the end):<\/p>\n<pre>\r\nlocation.href = newURL\r\n<\/pre>\n<p>When we put these two code snippets together, we end up with the following script:<\/p>\n<pre>\r\nlocation.href=\r\n    'https:\/\/www.wikiwand.com\/en\/'+getSelection().toString()\r\n<\/pre>\n<p>Now we only have to add the <code>javascript:<\/code> protocol to the front, and we have the <strong>final code<\/strong> we\u2019ll use in our bookmarklet:<\/p>\n<pre>\r\n\/\/ add in one line without line breaks\r\njavascript:location.href=\r\n    'https:\/\/www.wikiwand.com\/en\/'\r\n        +getSelection().toString().replace(\/\\n\/g,'%20')\r\n<\/pre>\n<p>The optional <code>replace(\/\\n\/g,'%20')<\/code> at the end <strong>replaces any new line character<\/strong> (<code>\\n<\/code>) in the text <strong>with a single space character<\/strong> (<code>%20<\/code>).<\/p>\n<p>The JavaScript code is ready. Note that the code need to be placed <strong>in a single line with no line breaks<\/strong>, since later it will be <strong>added to a text input field<\/strong>.<\/p>\n<h2>Create the bookmark<\/h2>\n<p>Open your browser\u2019s bookmark window, and <strong>add a new bookmark<\/strong>:<\/p>\n<ul>\n<li><strong>Firefox:<\/strong> Press <span class=\"key\">ctrl<\/span> + <span class=\"key\">shift<\/span> + <span class=\"key\">B<\/span> \/ <span class=\"key\">cmd<\/span> + <span class=\"key\">shift<\/span> + <span class=\"key\">B<\/span>, right-click \"Bookmarks Toolbar\", and select \"New Bookmark\".<\/li>\n<li><strong>Chrome:<\/strong> Press <span class=\"key\">ctrl<\/span> + <span class=\"key\">shift<\/span> + <span class=\"key\">O<\/span> \/ <span class=\"key\">cmd<\/span> + <span class=\"key\">alt<\/span> + <span class=\"key\">B<\/span>, right-click \"Bookmarks bar\", and select \"Add Page\u2026&quot.<\/li>\n<\/ul>\n<p>In the URL field <strong>copy-paste the JavaScript code<\/strong> from before. Once the bookmark is created it\u2019s ready to use; go to any web page, <strong>select a word<\/strong> you want to search for in Wikiwand, and <strong>click the bookmarklet<\/strong> \u2014 the Wikiwand article page will open at once.<\/p>\n<h3>Quick Access<\/h3>\n<p>Rather than reaching for the bookmarks menu every time you need the bookmarklet, you can choose to <strong>display it directly<\/strong> in your browser for quick access.<\/p>\n<ul>\n<li><strong>Firefox:<\/strong> Click \"View &gt; Toolbars\" in the top menu bar, and select \"Bookmarks Toolbar\".<\/li>\n<li><strong>Chrome:<\/strong> Press <span class=\"key\">ctrl<\/span> + <span class=\"key\">shift<\/span> + <span class=\"key\">B<\/span> \/ <span class=\"key\">cmd<\/span> + <span class=\"key\">shift<\/span> + <span class=\"key\">B<\/span>.<\/li>\n<\/ul>\n<h2>Create a bookmarklet link<\/h2>\n<p>You can add your bookmarklet to a website <strong>as a hyperlink<\/strong> as well, which visitors <strong>can bookmark<\/strong> by either simply drag-and-dropping the link to the bookmark toolbar, or right-clicking the link and selecting the option to bookmark it.<\/p>\n<p>To turn your bookmarklet into a hyperlink, create an <code>&lt;a&gt;<\/code> HTML tag with the bookmarklet script <strong>as the value of its <code>href<\/code> attribute<\/strong>:<\/p>\n<pre>\r\n&lt;!-- add in one line without line breaks --&gt;\r\n&lt;a href=\"javascript:location.href=\r\n  'https:\/\/www.wikiwand.com\/en\/'\r\n  +getSelection().toString().replace(\/\\n\/g,'%20')\"&gt;\r\n          Wikiwand Search Bookmarklet\r\n&lt;\/a&gt;\r\n<\/pre>\n<h2>How to store bookmarklets separately<\/h2>\n<p>You can also <strong>use a separate JavaScript file<\/strong> to store the bookmarklet code, which is probably not necessary if you have a short script \u2014 like the one we\u2019ve just seen in this tutorial \u2014 but can come handy when the JavaScript code is too long to copy-paste it to the bookmark bar of your browser.<\/p>\n<p>The file <code>myscript.js<\/code> will <strong>house the main JavaScript code<\/strong> for the bookmarklet, and you need to add the following code <strong>as the bookmark URL<\/strong> (either to the browser\u2019s bookmark bar, or as the value of the <code>href<\/code> attribute in the HTML file):<\/p>\n<pre>\r\n\/\/ add in one line without line breaks\r\njavascript:(()=>{\r\n  with(document){\r\n    let s=createElement('script');\r\n    s.src='myscript.js';\r\n    head.appendChild(s)}\r\n  })();\r\n<\/pre>\n<p>The code snippet above is <strong>wrapped in a self invoking arrow function<\/strong>, and uses <a href=\"https:\/\/www.hongkiat.com\/blog\/ecmascript-6\/\">features of ECMAScript 6<\/a>, such as the <code>let<\/code> keyword, in order to reduce code length. It adds a <code>&lt;script&gt;<\/code> tag pointing to the <code>myscript.js<\/code> file to the <code>&lt;head&gt;<\/code> section of the document <strong>when the user clicks the bookmarklet<\/strong> (note that you may need to use an absolute path for the <code>myscript.js<\/code> file).<\/p>\n<p>In my previous articles, you can read more on how to use the <a href=\"https:\/\/www.hongkiat.com\/blog\/useful-javascript-statements\/\"><code>with<\/code> statement<\/a> and <a href=\"https:\/\/www.hongkiat.com\/blog\/javascript-functions\/\">self-invoking JavaScript functions<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web pages. For instance, this bookmarklet by FontShop is for previewing FontShop web fonts on any web page. In this article, we are going to see how quick and easy it is to&hellip;<\/p>\n","protected":false},"author":145,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[4117,978],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Create a Text-Search Bookmarklet with JavaScript - Hongkiat<\/title>\n<meta name=\"description\" content=\"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web\" \/>\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.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Text-Search Bookmarklet with JavaScript\" \/>\n<meta property=\"og:description\" content=\"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-18T15:01:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T18:49:00+00:00\" \/>\n<meta name=\"author\" content=\"Preethi Ranjit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Preethi Ranjit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"How to Create a Text-Search Bookmarklet with JavaScript\",\"datePublished\":\"2016-10-18T15:01:33+00:00\",\"dateModified\":\"2025-04-03T18:49:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/\"},\"wordCount\":802,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"keywords\":[\"Javascripts\",\"Productivity Tips\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/\",\"name\":\"How to Create a Text-Search Bookmarklet with JavaScript - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"datePublished\":\"2016-10-18T15:01:33+00:00\",\"dateModified\":\"2025-04-03T18:49:00+00:00\",\"description\":\"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/make-bookmarklet-with-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Text-Search Bookmarklet with JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\",\"name\":\"Preethi Ranjit\",\"description\":\"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/preethi\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create a Text-Search Bookmarklet with JavaScript - Hongkiat","description":"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web","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.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Text-Search Bookmarklet with JavaScript","og_description":"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web","og_url":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2016-10-18T15:01:33+00:00","article_modified_time":"2025-04-03T18:49:00+00:00","author":"Preethi Ranjit","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Preethi Ranjit","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"How to Create a Text-Search Bookmarklet with JavaScript","datePublished":"2016-10-18T15:01:33+00:00","dateModified":"2025-04-03T18:49:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/"},"wordCount":802,"commentCount":6,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"keywords":["Javascripts","Productivity Tips"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/","url":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/","name":"How to Create a Text-Search Bookmarklet with JavaScript - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"datePublished":"2016-10-18T15:01:33+00:00","dateModified":"2025-04-03T18:49:00+00:00","description":"Bookmarklets are JavaScript applications that can be accessed as browser bookmarks. They are used to enable users to perform different actions on web","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/make-bookmarklet-with-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create a Text-Search Bookmarklet with JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3","name":"Preethi Ranjit","description":"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.","url":"https:\/\/www.hongkiat.com\/blog\/author\/preethi\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7lq","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=28236"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28236\/revisions"}],"predecessor-version":[{"id":73732,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28236\/revisions\/73732"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=28236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=28236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=28236"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=28236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}