# The “codebase” attribute on the “object” element is obsolete. Use the “data” and “type” attributes to invoke plugins.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-codebase-attribute-on-the-object-element-is-obsolete-use-the-data-and-type-attributes-to-invoke-plugins
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `codebase` attribute told the browser where to get the code an `<object>` needed, and browsers ignore it today: the resource URL goes in `data` and its MIME type in `type`.

In Flash embed code, `codebase` holds the address of the Flash Player installer for Internet Explorer, a `swflash.cab` file on Macromedia's download server, followed by a fragment such as `#version=10,0,0,0`. Internet Explorer compared that version with the ActiveX control installed on the computer and, when the control was missing or older, offered to download and install the `.cab` file. Other ActiveX controls, like the ones for QuickTime and Windows Media Player, came with their own `.cab` URLs in the same attribute.

HTML 4.01 gave `codebase` a second job: a base path for relative URLs in the `classid`, `data` and `archive` attributes. With `codebase="/media/"` and `data="intro.swf"`, the file was meant to load from `/media/intro.swf`. Browsers now resolve `data` against the page's URL like any other link, and none of them download installers from `codebase`.

Deleting the attribute clears this warning without changing what the page shows, since browsers already skip it. For Flash embed code, that isn't enough: the `classid` warning stays, the validator still reports the missing `data` attribute and the obsolete `<param>` elements, and the box stays empty because no current browser plays `.swf` files. Replace the whole `<object>`, `<param>` and `<embed>` elements included, with the same content in a format browsers support, such as a `<video>` for a movie or an `<img>` for a static banner.

If the page relied on `codebase` as a base path, browsers already request the file from the wrong address. Write the full path into `data`, then remove `codebase`.

## Examples

### Invalid: Flash embed code with a `.cab` installer

```html
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://example.com/cabs/flash/swflash.cab#version=10,0,0,0" width="640" height="360">
  <param name="movie" value="intro.swf">
  <embed src="intro.swf" type="application/x-shockwave-flash" width="640" height="360">
</object>
```

### Valid: the movie as a video

```html
<video src="intro.mp4" controls width="640" height="360"></video>
```

### Invalid: `codebase` as a base path for `data`

```html
<object codebase="/files/reports/" data="annual-report.pdf" type="application/pdf" width="600" height="400">
  <a href="/files/reports/annual-report.pdf">Download the annual report (PDF)</a>
</object>
```

### Valid: the full path in `data`

```html
<object data="/files/reports/annual-report.pdf" type="application/pdf" width="600" height="400">
  <a href="/files/reports/annual-report.pdf">Download the annual report (PDF)</a>
</object>
```
