Skip to main content
HTML Validation

Bad value X for attribute “data” on element “object”: Illegal character in path segment. Space is not allowed.

About This HTML Issue

The path in an <object> element's data attribute can't contain a literal space, so write each space as %20 or rename the file so its URL has none.

The data attribute holds the URL of the resource the object embeds, often a PDF, and the URL Standard doesn't allow spaces in a path. The validator reports values like /docs/annual report.pdf, and one stray space is enough, as in /docs/fees_ 2025.pdf. Accented letters in a file name are allowed, so only the space needs fixing.

Browsers percent-encode the space when they request the file, so the embedded document usually still shows. The markup is invalid anyway, and a tool that reads the raw value may not encode it. A space after the ? gives a different message, Illegal character in query, and %20 fixes that one too.

When the object has a fallback link to the same file, the link's href gets its own Illegal character in path segment error. Change both values together.

Invalid example

<object data="/docs/annual report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual report.pdf">Download the annual report (PDF)</a></p>
</object>

Valid example: space encoded as %20

<object data="/docs/annual%20report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual%20report.pdf">Download the annual report (PDF)</a></p>
</object>

Valid example: hyphen instead of a space

<object data="/docs/annual-report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual-report.pdf">Download the annual report (PDF)</a></p>
</object>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries