# Attribute “xmlns:fb” not allowed here.

> Canonical HTML version: https://rocketvalidator.com/html-validation/attribute-xmlns-fb-not-allowed-here
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `xmlns:fb` attribute was an XML namespace declaration used to enable FBML (Facebook Markup Language) tags on websites. FBML allowed developers to embed Facebook-specific elements like `<fb:like>`, `<fb:comments>`, and `<fb:share-button>` directly in their HTML. Facebook officially retired FBML in 2011 and replaced it with the JavaScript SDK and social plugins, yet many websites still carry this outdated namespace declaration in their markup.

In HTML5, the only `xmlns` attribute allowed on the `<html>` element is the standard `xmlns="http://www.w3.org/1999/xhtml"`, and even that is optional. Custom namespace prefixes like `xmlns:fb` or `xmlns:og` are XML constructs that have no meaning in HTML5 and are flagged as validation errors.

## Why This Is a Problem

- **Standards compliance:** HTML5 does not support arbitrary XML namespace declarations. The `xmlns:fb` attribute violates the HTML specification, producing a validation error.
- **Dead technology:** FBML no longer functions. Facebook's servers no longer process FBML tags, so the namespace serves no purpose whatsoever.
- **Code cleanliness:** Keeping deprecated, non-functional attributes in your markup adds confusion for developers maintaining the codebase and suggests the site hasn't been updated in a long time.

## How to Fix It

1. **Remove `xmlns:fb`** (and any other custom namespace like `xmlns:og`) from your `<html>` tag.
2. **Remove any FBML tags** such as `<fb:like>`, `<fb:comments>`, or `<fb:share-button>` from your page content.
3. **Replace with modern alternatives:**
   - Use the [Facebook JavaScript SDK](https://developers.facebook.com/docs/javascript/) for social plugins.
   - Use Open Graph `<meta>` tags in the `<head>` to control how your pages appear when shared on Facebook. These `<meta>` tags use the `property` attribute (e.g., `property="og:title"`) and do not require any namespace declaration in HTML5.

## Examples

### ❌ Invalid: Using `xmlns:fb` on the `<html>` tag

```html
<!DOCTYPE html>
<html lang="en" xmlns:fb="http://ogp.me/ns/fb#">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <fb:like href="https://example.com" width="300"></fb:like>
  </body>
</html>
```

This triggers the error **"Attribute 'xmlns:fb' not allowed here"** because HTML5 does not permit custom XML namespace prefixes on the `<html>` element. The `<fb:like>` tag is also invalid HTML and no longer functional.

### ✅ Valid: Using Open Graph meta tags and the JavaScript SDK

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>My Page</title>
    <meta property="og:title" content="My Page">
    <meta property="og:description" content="A description of my page.">
    <meta property="og:url" content="https://example.com">
    <meta property="og:image" content="https://example.com/image.jpg">
  </head>
  <body>
    <h1>My Page</h1>
    <!-- Facebook Like button using the JavaScript SDK -->
    <div class="fb-like" data-href="https://example.com" data-width="300" data-layout="button_count"></div>
    <script async defer crossorigin="anonymous"
      src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v18.0">
    </script>
  </body>
</html>
```

The `xmlns:fb` attribute is gone, Open Graph metadata is provided via standard `<meta>` tags, and the like button is rendered using Facebook's JavaScript SDK with `data-*` attributes—all fully valid HTML5.
