# srcdoc-polyfill **Repository Path**: bingookfantasy/srcdoc-polyfill ## Basic Information - **Project Name**: srcdoc-polyfill - **Description**: A shim for the iFrame "srcdoc" attribute - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-02 - **Last Updated**: 2021-08-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # `srcdoc` polyfill [![Build Status](https://travis-ci.org/jugglinmike/srcdoc-polyfill.svg)](https://travis-ci.org/jugglinmike/srcdoc-polyfill) HTML5 defines a new attribute for iFrames named `srcdoc`. This attribute allows developers to specify an iFrame's content in-line with the iFrame itself. For instance: This feature only began to see adoption in major browsers in early 2013. Fortunately, most older browsers support similar functionality through script-targeted URLs, i.e. (Because of limitations on URL length, the actual mechanism that the polyfill implements not quite this direct.) For more on `srcdoc`, see [the WhatWG specification](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-srcdoc) and [this post on Bocoup.com](http://weblog.bocoup.com/third-party-javascript-development-future/). ## Usage By including the script at the bottom of the document ``, any available iFrames which declare a `srcdoc` attribute attribute) will receive this "shimmed" behavior. (In browsers that already implement this functionality, no change will take place.) **Note on [the HTML5 `sandbox` attribute](https://html.spec.whatwg.org/multipage/embedded-content.html#attr-iframe-sandbox):** Because the shim operates using a script-targeted URL in legacy environments, some configurations of the `sandbox` attribute may interfere with its behavior. This issue will only surface in environments that implement `sandbox` but that do *not* implement `srcdoc`. Because of this, this polyfill's default behavior is to issue a warning for potentially-hazardous configurations but to proceed optimistically. The API supports an `force` option that enables modification of this behavior. ## Executing This script may be consumed as a AMD module, a CommonJS module, or standalone via direct inclusion with a `