craft-embedded-assets
craft-embedded-assets copied to clipboard
How to remove frameborder attribute from iframe?
Description
When Craft GraphQL return the iframeCode it includes the frameborder attribute. This is provoking the following w3 validation error:
Error: The frameborder attribute on the iframe element is obsolete. Use CSS instead.
Is there a way to remove that attribute from iframe code?
Steps to reproduce
- Check iframeCode in GraphQL query
Other information
- Embedded Assets version: 2.10.7
- Craft CMS version: 3.7.43
There's currently no in-built way to remove iframe attributes, but that's something we can look at for a future release.
Just released Embedded Assets 3.0.5 - iframeCode now accepts a removeAttributes argument which is an array of the attributes you want to remove, e.g.:
assetField {
embeddedAsset {
iframeCode(removeAttributes: ["frameborder"])
}
}
@ttempleton great. Thanks for informing us.