Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Auto height iFrames on Boston.gov

iFrames that resize based on the content of the page is possible for Boston.gov. In order to get them working, you will need to include a snippet of JS on the page that will be iframed. The code for this is:

<script>
    window.iFrameResizer = {
    targetOrigin: 'https://www.boston.gov'
  }
</script>
<script src="https://www.boston.gov/sites/all/themes/custom/boston_public/dist/js/resizer.client.js"></script>

Drop this code into the <head> of your HTML document. In Drupal, select Auto when adding the iFrame component.

If you have any issues, send an email to feedback@boston.gov. Make sure to include the URL of the page you're adding the component to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment