{"id":1406,"date":"2023-02-16T14:25:18","date_gmt":"2023-02-16T14:25:18","guid":{"rendered":"https:\/\/www.tools.keywordfinder.us\/?page_id=1406"},"modified":"2023-02-16T14:25:18","modified_gmt":"2023-02-16T14:25:18","slug":"web-keyword-density","status":"publish","type":"page","link":"https:\/\/tools.billionsideas.com\/hi\/web-keyword-density\/","title":{"rendered":"Web Keyword Density"},"content":{"rendered":"<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column has-base-3-background-color has-background is-layout-flow wp-block-column-is-layout-flow\">\n <section>\n  \n    <h1>Website Keyword Density Checker<\/h1>\n    <link rel=\"stylesheet\" type=\"text\/css\" href=\"checkDensity.css\">\n  \n \n    <div class=\"container\">\n      <center><form action=\"\">\n        <label for=\"url\">Enter URL:<\/label><br>\n        <input type=\"text\" id=\"url\" placeholder=\"https:\/\/www.example.com\"><br><br>\n        <label for=\"keyword\">Enter Keyword:<\/label><br>\n        <input type=\"text\" id=\"keyword\"><br><br>\n        <button type=\"button\" onclick=\"checkDensity()\">Check Density<\/button><br>\n        <p><b>Please wait for few seconds! we&#8217;re checking&#8230;<\/b><\/p>\n      <input type=\"hidden\" name=\"trp-form-language\" value=\"hi\"\/><\/form><\/center>\n      <center><div id=\"response\"><\/div><\/center><br><br>\n    <\/div><\/section>\n    <script src=\"checkDensity.js\"><\/script>\n\n<script>\nfunction checkDensity() {\n    const url = document.getElementById('url').value;\n    const keyword = document.getElementById('keyword').value;\n    const responseDiv = document.getElementById('response');\n\n    if (!url || !keyword) {\n        responseDiv.innerHTML = '<p class=\"error\">Please enter both URL and keyword<\/p>';\n        return;\n    }\n\n    fetch(url)\n        .then(response => response.text())\n        .then(text => {\n            \/\/ Count the number of times the keyword appears in the website\n            const keywordRegex = new RegExp(`\\\\b${keyword}\\\\b`, 'gi');\n            const keywordCount = (text.match(keywordRegex) || []).length;\n\n            \/\/ Calculate the density of the keyword\n            const density = (keywordCount \/ text.split(' ').length) * 100;\n\n            \/\/ Display the density percentage\n            responseDiv.innerHTML = `<p>Keyword density: <span class=\"density\">${density.toFixed(2)}%<\/span><\/p>`;\n        })\n        .catch(error => {\n            responseDiv.innerHTML = `<p class=\"error\">Error checking density: ${error}<\/p>`;\n        });\n}\n\n<\/script>\n\n\n\n\n<style>\n\n  section{\n         margin-top:60px;\n        width: 100%;\n        max-width: 970px;\n        background-color: #fff;\n        border: 1px solid #ddd;\n        padding: 25px;\n      }\n<\/style>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Website Keyword Density Checker Enter URL: Enter Keyword: Check Density Please wait for few seconds! we&#8217;re checking&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","footnotes":""},"class_list":["post-1406","page","type-page","status-publish"],"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"Billions Ideas","author_link":"https:\/\/tools.billionsideas.com\/hi\/author\/loginbillionsideas-com\/"},"comment_info":0,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/pages\/1406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/comments?post=1406"}],"version-history":[{"count":0,"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/pages\/1406\/revisions"}],"wp:attachment":[{"href":"https:\/\/tools.billionsideas.com\/hi\/wp-json\/wp\/v2\/media?parent=1406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}