craft-embedded-assets icon indicating copy to clipboard operation
craft-embedded-assets copied to clipboard

How to remove frameborder attribute from iframe?

Open OneX opened this issue 3 years ago • 1 comments

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

  1. Check iframeCode in GraphQL query

Other information

  • Embedded Assets version: 2.10.7
  • Craft CMS version: 3.7.43

OneX avatar Jun 27 '22 10:06 OneX

There's currently no in-built way to remove iframe attributes, but that's something we can look at for a future release.

ttempleton avatar Jun 28 '22 08:06 ttempleton

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 avatar Aug 30 '22 09:08 ttempleton

@ttempleton great. Thanks for informing us.

OneX avatar Aug 30 '22 16:08 OneX