ShieldX Toolly
Open a tool Donate
Home Home
Blog Blog
FAQ FAQ
Open a tool Donate
Back to cheatsheets
Web Security

Mixed Content Detection

Detect HTTP resources loaded on HTTPS pages and fix mixed-content warnings.

2 snippets Beginner mixed-content-checker
mixed contentHTTPSHTTP resourcesbrowser warnings

What you'll learn

  • Check for mixed content
  • Fix with upgrade-insecure-requests

How to use these snippets

  1. Click the Copy button next to any snippet to copy it to your clipboard.
  2. Paste the code into your project, IDE, or terminal.
  3. Replace placeholder values (like example.com or your-secret) with your actual data.
  4. Review the code comments for important security notes and caveats.
  5. Try the interactive related tool to see the concept in action.
Code Snippets

Copy-paste code snippets

2 ready-to-use snippets for mixed content detection. Click copy and paste into your project.

Check for mixed content
                // Scan DOM for HTTP resources on HTTPS pages
function findMixedContent() {
  const issues = [];
  const protocol = location.protocol;

  if (protocol !== 'https:') return issues;

  // Check img, script, link, iframe, video, audio
  const selectors = [
    'img[src]', 'script[src]', 'link[href]',
    'iframe[src]', 'video[src]', 'audio[src]',
    'source[src]', 'object[data]'
  ];

  document.querySelectorAll(selectors.join(','))
    .forEach(el => {
      const url = el.src || el.href || el.data;
      if (url && url.startsWith('http:')) {
        issues.push({
          tag: el.tagName,
          url: url,
          type: el.tagName.toLowerCase()
        });
      }
    });

  return issues;
}
              
Fix with upgrade-insecure-requests
                # CSP directive to auto-upgrade HTTP to HTTPS
Content-Security-Policy: upgrade-insecure-requests

# Nginx
add_header Content-Security-Policy
  "upgrade-insecure-requests";

# This tells the browser to rewrite all HTTP
# resource requests to HTTPS automatically.
              
Tool

Try this concept hands-on with the interactive tool.

100% Free · No signup · No cost

Generate something unguessable right now

148 bits of entropy, a crack-time estimate you can trust, and a clipboard that clears itself after 30 seconds.

Open the toolkit

Part of the Toolly ecosystem · secure.toolly.site