SEO Bookmarklets

Published: January 15, 2025 | Author: Aubrey Yung

SEO Bookmarklets

A bookmarklet is a Javascript code that can be saved as a bookmark in your internet browser (such as Google Chrome or Firefox), which allows users to perform certain functions by clicking on it.

To create a bookmarklet, simply go to Bookmarks > Bookmark Manager > Add New Bookmark , add the bookmark name, and paste the JavaScript in the URL field.

Once you click on the bookmarklet, it will execute the code on the current page you are viewing, providing a convenient way to use tools or scripts without having to navigate away from the page.

It has become a very handy shortcut for me to perform different SEO analysis. This article is a collection of bookmarklets that I tested and used.

Validate the schema in Schema.org

This bookmarklet helps instantly check the schema markup is used on the page and also validate in Schema.org if there’s any error or missing for the markup used.

View and validate the schema
javascript: (function() {
   window.open('https://validator.schema.org/#url='+window.location)
})();

Validate the structured data in Google Rich Results Test

This bookmarklet allows you to quickly test any webpage for structured data compatibility with Google’s Rich Results. By clicking the bookmarklet, it opens the Google Rich Results Test with the current page’s URL preloaded, saving time and eliminating the need to copy and paste the URL manually.

Validate the structured data in Google Rich Results Test
javascript:(function(){window.open('https://search.google.com/test/rich-results?url='+encodeURIComponent(window.location.href));})();

Open the current page on Wayback machine

The Wayback Machine bookmarklet helps me retrieve archived versions of a webpage quickly, and allows me to analyse changes over time. If I noticed a competitor has a page improved significantly, this help

Open the current page on Wayback machine
javascript:(function(){window.open('https://search.google.com/test/rich-results?url='+encodeURIComponent(window.location.href));})();

Filter the exact URL in the Google Search Console

This bookmarklet filters the GSC data for the exact URL you are viewing, so you can instantly see the performance without going to GSC manually. This one has saved me a lot of time!

If you have multiple property in your Google Search Console, you will see an error message. Don’t worry – just choose the property from the dropdown and you will be directed to the URL performance report.

Filter the exact URL in the Google Search Console
javascript: (function() {
window.open(`https://search.google.com/search-console/performance/search-analytics?resource_id=${encodeURIComponent(window.location.origin)}&page=!${encodeURIComponent(window.location.href)}`)
   })();

Open Sitemap

This bookmarklet allows you to open sitemap directly in your browser, but it only works if the sitemap file ends with sitemap.xml.

In case your website uses a sitemap_index, you would need to tweak the function a bit.

Open sitemap
javascript:(function(){var%20url=window.location.protocol+'//'+window.location.hostname+'/sitemap.xml';window.open(url,'_blank');})();

Open robots.txt

I use this bookmarklet to quickly access robots.txt , it helps me review which sections of the site or any crawlers are being disallowed.

Open robots.txt
javascript:(function(){var%20url=window.location.protocol+'//'+window.location.hostname+'/robots.txt';window.open(url,'_blank');})();

Check competitor on SEO tools

Checking competitors’ domain or URL on SEO tools is my day-to-day. With this bookmarklet, I can directly open Ahrefs or SEMRush to analyze the domain or URL organic traffic and keyword data.

Check domain on Ahrefs

Check domain on Ahrefs
javascript:(function(){ window.open('https://app.ahrefs.com/site-explorer/overview/v2/prefix/live?target='+location.host)})(); 

Check Exact URL on Ahrefs

Check Exact URL on Ahrefs
javascript:(function(){ window.open('https://app.ahrefs.com/site-explorer/overview/v2/prefix/live?target='+window.location)})();

Domain Overview on SEMRush

Domain Overview on SEMRush
javascript:(function(){ window.open('https://www.semrush.com/analytics/overview/?searchType=domain&q='+window.location)})();

Exact URL Overview on SEMRush

Exact URL Overview on SEMRush
javascript:(function(){ window.open('https://www.semrush.com/analytics/overview/?searchType=url&q='+window.location)})();

By converting the text of a link into the actual URL, it simplifies the process of copying links directly from a webpage.

Convert Anchor Text to Href Link
javascript:(function(){var i,c,x,h; for(i=0;x=document.links[i];++i) { h=x.getAttribute("href"); x.title+=" " + x.innerHTML; while(c=x.firstChild)x.removeChild(c); x.appendChild(document.createTextNode(h)); } })()

Open PageSpeed Insight Test

The PageSpeed Insights tool by Google provides information into areas that need optimization, allowing for the implementation of best practices that result in faster loading times and better overall performance.

Open PageSpeed Insight Test
javascript:(function(){ window.open('https://developers.google.com/speed/pagespeed/insights/?url='+encodeURIComponent(location.href))})();

Extract schema markup

Unlike opening the schema markup on the validator directly, it extracts only the schema markup without other HTML elements.

It makes the schema markup easier to copy and clear to understand the code structure as they are not condensed in the same line inside the code editor.

You can directly copy the schema markup with a button click
Extract schema markup
javascript:(function(){const scripts=document.querySelectorAll('script[type="application/ld+json"]');const jsonLdData=[];scripts.forEach(script=>{try{const jsonData=JSON.parse(script.textContent);jsonLdData.push(jsonData);}catch(error){console.error("Error parsing JSON-LD:",error,script.textContent);}});if(jsonLdData.length>0){const formattedJson=JSON.stringify(jsonLdData,null,2);const highlightedJson=formattedJson.replace(/("https?:\/\/schema\.org\/[^"]*")/g,'<span style="background-color:#66e9ad;color:#2f1daf;">$1</span>');const blob=new Blob([`<html><head><title>JSON-LD Viewer</title><style>body{font-family:Arial,sans-serif;padding:20px;background:#ffffff;color:#2f1daf;}h1{color:#2f1daf;}button{background:#2f1daf;color:#ffffff;border:none;padding:10px 16px;border-radius:5px;font-size:14px;cursor:pointer;margin-bottom:15px;}button:hover{background:#00adff;}pre{background:#ffffff;padding:15px;border:2px solid #00adff;border-radius:6px;overflow:auto;white-space:pre-wrap;word-wrap:break-word;}span{font-weight:bold;}footer{margin-top:25px;padding-top:12px;border-top:2px solid #00adff;font-size:14px;}footer a{color:#2f1daf;font-weight:bold;text-decoration:none;}footer a:hover{color:#00adff;text-decoration:underline;}</style></head><body><h1>Extracted JSON-LD</h1><button onclick="copyJSON()">Copy JSON</button><pre id="schema">${highlightedJson}</pre><footer>Created by <a href="https://aubreyyung.com" target="_blank">Aubrey Yung</a></footer><script>const rawJson=\`${formattedJson.replace(/`/g,'\\`')}\`;function copyJSON(){navigator.clipboard.writeText(rawJson).then(()=>{alert('JSON-LD copied to clipboard');});}</script></body></html>`],{type:"text/html"});const blobUrl=URL.createObjectURL(blob);const newTab=window.open(blobUrl,'_blank');newTab.focus();}else{console.log("No JSON-LD Schema Markup found on this page.");}})();

Extract URLs from SERP

This bookmarklet extracts URLs from search engine results pages (SERPs) and streamlines the data collection process for SERP analysis. Instead of manually copying and pasting each URLs, you can quickly gather the full list and start analysing competitors faster.

Extract URLs from SERP
javascript: var a = document.getElementsByTagName('a'),   arr = '';for (var i = 0; i < a.length; i++)   if (a[i].ping && !a[i].href.includes('google')) arr += ('<p>' + a[i].href + '</p>');var newWindow = window.open();newWindow.document.write(arr);newWindow.document.close();

Highlight Heading

The bookmarklet color-codes each heading tier, so you can quickly visualise the structure of a webpage’s content at a glance without using any browser extension.

Highlight Heading
javascript:void((function(){var a,b,c,d,e,f;f=new Array('yellow','orange','aquamarine','lightskyblue','pink','plum');for(a=1;a<=6;a++){b=document.getElementsByTagName('h'+a);for(c=0;c<b.length;c++){d=b[c];e=d.style;e.backgroundColor=f[a-1];e.border='solid';e.padding='2px';e.color='black';d.innerHTML='H'+a+' - '+d.innerHTML;}}})())

Extract Heading in a new tab

If you need to copy the website structure, this bookmarklet extracts the heading and list them in a new tab.

Extract Heading in a new tab
javascript:(function(){
   var headings = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
   var headingList = "";
   headings.forEach(function(heading) {
     headingList += heading.tagName + ": " + heading.textContent + "\n";
   });
   var newWindow = window.open();
   newWindow.document.write("<pre>" + headingList + "</pre>");
 })();

This bookmarklet generates a list of internal links on the webpage and displays them in a new window.

Create Internal Link Table
javascript:(function() {
    var links = document.querySelectorAll("a");
    var linkTable = `
        <style>
            table {
                width: 100%;
                border-collapse: collapse;
                margin: 20px 0;
                font-size: 16px;
                text-align: left;
            }
            th, td {
                border: 1px solid #ddd;
                padding: 8px;
            }
            th {
                background-color: #f4f4f4;
                color: #333;
            }
            tr:nth-child(even) {
                background-color: #f9f9f9;
            }
        </style>
        <table>
            <thead>
                <tr>
                    <th>URL</th>
                    <th>Anchor</th>
                    <th>Rel Attribute</th>
                </tr>
            </thead>
            <tbody>`;
    links.forEach(function(link) {
        if (link.href.startsWith(window.location.origin)) {
            var relAttr = link.getAttribute("rel") || "none";
            linkTable += `
                <tr>
                    <td>${link.href}</td>
                    <td>${link.textContent.trim() || "No Text"}</td>
                    <td>${relAttr}</td>
                </tr>`;
        }
    });
    linkTable += `
            </tbody>
        </table>`;
    var newWindow = window.open();
    newWindow.document.write(linkTable);
})();

Show Page Title and Description

Understanding a webpage’s meta title and description is crucial for on-page optimisation.

With this bookmarklet, you can easily extract and review a page’s title and meta description without the need to view the page source or use developer tools. It also shows the character count.

Show Page Title and Description
javascript:(function(){
   var metaTitle = document.querySelector('title').textContent;
   var metaDescription = document.querySelector('meta[name="description"]');
   var descriptionContent = metaDescription ? metaDescription.content : 'No meta description found';
   var titleCharacterCount = metaTitle.length;
   var descriptionCharacterCount = descriptionContent.length;
   var finalMessage = "Meta Title: " + metaTitle + " (" + titleCharacterCount + " characters)\nMeta Description: " + descriptionContent + " (" + descriptionCharacterCount + " characters)";
   alert(finalMessage);
 })();

Check Canonical URL

Checking if a URL matches the canonical version ensures consistent indexing and prevents duplicate content penalties. It helps consolidate link equity and optimize crawl efficiency for search engines.

This SEO bookmarklet allows you to check if the canonical URL matches the current URL.

Check Canonical URL
javascript: (function () { var url = document.location; var links = document.getElementsByTagName('link'); var found = 'Not Found'; for (var i = 0, l; l = links[i]; i++) { if (l.getAttribute('rel') == 'canonical') { found = 'Canonical Found\n\nCanonical Reference:\n'+l.getAttribute('href')+'\n\nCurrent URL:\n'+document.location;if(l.getAttribute('href')==document.location){found=found+'\n\nCanonical tag matches current URL.'}else{found=found+'\n\nThe Canonical reference and current URL are different. Canonical fallback in place.'} break; } } alert(found); })();

Scrape and copy People Also Asked

Although FAQ rich result is downgraded, People Also Asked still gives me good inspiration to write a content – it helps me understand what questions the users are getting and I often use them when briefing and writing my articles.

This bookmarklet thus comes in handy by copying the People Also Asked on the SERP directly to clipboard.

Scrape and copy People Also Asked
javascript:(function() {
    const paas = [...document.querySelectorAll('.related-question-pair .JCzEY span')];
    const output = paas.map(paa => paa.textContent.trim() || 'No Question Found').join('\n');
    if (output) {
        const newTab = window.open();
        newTab.document.open();
        newTab.document.write('<html><head><title>People Also Ask</title></head><body>');
        newTab.document.write('<pre>' + output.replace(/</g, '&lt;').replace(/>/g, '&gt;') + '</pre>');
        newTab.document.write('</body></html>');
        newTab.document.close();
        
        const textArea = document.createElement('textarea');
        textArea.value = output;
        document.body.appendChild(textArea);
        textArea.select();
        document.execCommand('copy');
        document.body.removeChild(textArea);
        alert(`Copied questions to clipboard!`);
    } else {
        alert('No questions found in the People Also Ask section.');
    }
})();

Extract hreflang attribute

This bookmarklet extracts and displays all hreflang attributes from <link rel=”alternate”> tags on a webpage.

With a single click, it opens a popup showing the language or regional targeting (hreflang) and the corresponding URLs, making it easy to verify hreflang implementation and spy on competitors to check what countries they are operating in.

Extract hreflang attribute
javascript:(function(){let hreflangs=[];document.querySelectorAll('link[rel="alternate"][hreflang]').forEach(link=>{hreflangs.push(`${link.getAttribute('hreflang')}: ${link.getAttribute('href')}`);});if(hreflangs.length>0){alert('Hreflang Tags Found:\n\n' + hreflangs.join('\n'));}else{alert('No hreflang tags found on this page.');}})();

Final thoughts

With the SEO bookmarklet, you can streamline your workflow and save a lot of time from opening multiple tabs or copying and pasting information.

If there are any repetitive tasks that you would like to simplify, try to look for resources and see if there is smarter way to do that.

Aubrey Yung

Aubrey Yung

Aubrey is an SEO Manager and Schema Markup Consultant with years of B2B and B2C marketing experience. Outside of work, she loves traveling and learning languages.

Related Post

Analytics

Google Apps Script for SEO

Create custom function in Google Sheets with this Google Apps Script cheat sheet. Automate tasks like checking HTTP status codes and fetching meta data.

SEO

Best Chrome Extensions for SEO

In this post, I’m sharing my favorite free SEO Chrome extensions that I personally use to get the job done faster and more effectively.

Analytics

29 Google Sheets Formula for SEO

Learn how to quickly and easily analyze, plan, and track your SEO campaigns. Save time and effort by using these 29 powerful Google Sheets formulas.