Claude Skills Guide

A Chrome extension meta tag viewer gives developers and power users a streamlined way to inspect HTML metadata directly in the browser. Instead of viewing page source code or using external tools, you can analyze Open Graph tags, Twitter Card metadata, and custom meta properties with a single click. This guide walks you through building your own meta tag viewer extension and explores practical use cases for web development, SEO analysis, and content verification.

Why Inspect Meta Tags in a Chrome Extension

Meta tags live in the <head> section of HTML documents. They communicate essential information to browsers, search engines, and social media platforms. Common meta tags include:

When building web applications or auditing existing sites, you frequently need to verify these values. Opening Developer Tools, locating the <head> section, and scanning through markup becomes tedious with repeated use. A dedicated Chrome extension eliminates this friction.

Building a Chrome Extension Meta Tag Viewer

A Chrome extension consists of a manifest file, background scripts or service workers, and popup or content scripts. For a meta tag viewer, the architecture stays straightforward.

Project Structure

meta-tag-viewer/
├── manifest.json
├── popup.html
├── popup.js
└── icons/
    ├── icon16.png
    ├── icon48.png
    └── icon128.png

Manifest Configuration

The manifest declares permissions and defines the extension’s behavior:

{
  "manifest_version": 3,
  "name": "Meta Tag Viewer",
  "version": "1.0.0",
  "description": "Inspect HTML meta tags on any webpage",
  "permissions": ["activeTab", "scripting"],
  "action": {
    "default_popup": "popup.html",
    "default_icon": {
      "16": "icons/icon16.png",
      "48": "icons/icon48.png",
      "128": "icons/icon128.png"
    }
  }
}

Version 3 of the manifest format replaced background pages with service workers. This example uses the scripting permission to execute code within the active tab.

The popup interface displays the extracted meta information:

<!DOCTYPE html>
<html>
<head>
  <style>
    body { width: 320px; padding: 16px; font-family: system-ui, sans-serif; }
    h2 { margin: 0 0 12px; font-size: 16px; }
    .tag-group { margin-bottom: 16px; }
    .tag-label { font-weight: 600; font-size: 12px; color: #666; }
    .tag-value { font-size: 13px; word-break: break-all; margin-top: 4px; }
    .section-title { font-size: 14px; font-weight: bold; margin: 16px 0 8px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
  </style>
</head>
<body>
  <h2>Meta Tag Viewer</h2>
  <div id="results">Loading...</div>
  <script src="popup.js"></script>
</body>
</html>

JavaScript Logic

The popup script injects code into the active tab to extract meta tags:

document.addEventListener('DOMContentLoaded', async () => {
  const results = document.getElementById('results');
  
  try {
    const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
    
    const metaTags = await chrome.scripting.executeScript({
      target: { tabId: tab.id },
      function: extractMetaTags
    });
    
    renderResults(metaTags[0].result);
  } catch (error) {
    results.innerHTML = `<p>Error: ${error.message}</p>`;
  }
});

function extractMetaTags() {
  const tags = {
    basic: [],
    og: [],
    twitter: [],
    other: []
  };
  
  // Extract title
  const title = document.querySelector('title');
  if (title) tags.basic.push({ name: 'title', content: title.textContent });
  
  // Extract all meta tags
  document.querySelectorAll('meta').forEach(meta => {
    const name = meta.getAttribute('name') || meta.getAttribute('property') || meta.getAttribute('http-equiv');
    const content = meta.getAttribute('content');
    
    if (!name || !content) return;
    
    const tag = { name, content };
    
    if (name.startsWith('og:')) {
      tags.og.push(tag);
    } else if (name.startsWith('twitter:')) {
      tags.twitter.push(tag);
    } else {
      tags.other.push(tag);
    }
  });
  
  return tags;
}

function renderResults(tags) {
  let html = '';
  
  if (tags.basic.length) {
    html += '<div class="tag-group">';
    tags.basic.forEach(tag => {
      html += `<div class="tag-label">${tag.name}</div><div class="tag-value">${tag.content}</div>`;
    });
    html += '</div>';
  }
  
  if (tags.og.length) {
    html += '<div class="section-title">Open Graph</div>';
    tags.og.forEach(tag => {
      html += `<div class="tag-label">${tag.name}</div><div class="tag-value">${tag.content}</div>`;
    });
  }
  
  if (tags.twitter.length) {
    html += '<div class="section-title">Twitter Cards</div>';
    tags.twitter.forEach(tag => {
      html += `<div class="tag-label">${tag.name}</div><div class="tag-value">${tag.content}</div>`;
    });
  }
  
  if (tags.other.length) {
    html += '<div class="section-title">Other Meta Tags</div>';
    tags.other.forEach(tag => {
      html += `<div class="tag-label">${tag.name}</div><div class="tag-value">${tag.content}</div>`;
    });
  }
  
  document.getElementById('results').innerHTML = html || '<p>No meta tags found</p>';
}

The executeScript method runs the extraction function directly in the page context, giving it access to the full DOM.

Practical Use Cases

Verifying Social Media Previews

Before publishing a new blog post or product page, check how it will appear when shared. Navigate to your page, click the extension icon, and verify:

Missing or incorrect Open Graph tags cause poor link previews, reducing click-through rates from social media traffic.

Debugging SEO Issues

Search Console and other SEO tools report meta tag problems, but they don’t always explain the cause. Use the extension to compare what you intended versus what the page actually renders. Common issues include:

Auditing Third-Party Integrations

Many third-party services inject meta tags for tracking and verification. Analytics platforms add conversion tracking pixels. Social login providers insert OpenID connect tags. Payment gateways include transaction confirmation meta tags. A meta tag viewer helps you verify these integrations without searching through page source.

Building Meta Tag Management Tools

If you develop CMS plugins or website builders, testing your meta tag generation requires constant verification. Running a custom meta tag viewer during development catches problems early. You can extend the basic viewer to:

Loading Your Extension

Chrome provides developer mode for testing unsigned extensions:

  1. Navigate to chrome://extensions/
  2. Enable “Developer mode” in the top-right corner
  3. Click “Load unpacked”
  4. Select your extension’s directory

The extension icon appears in your toolbar. Visit any webpage and click it to view all associated meta tags.

Summary

A Chrome extension meta tag viewer transforms metadata inspection from a multi-step process into a single click. The manifest, popup interface, and injection script combine to extract structured data from any webpage. Developers use these tools daily for SEO audits, social sharing verification, and integration debugging. Building your own gives you full control over the presentation and can be customized for specific workflows.

The complete code above provides a functional foundation. From here, you can add features like tag filtering, export capabilities, or integration with APIs for automated testing. Metadata affects how your content appears across the web, and having the right tools to inspect it quickly saves development time.

Built by theluckystrike — More at zovo.one