Skip to content

Instantly share code, notes, and snippets.

@matthewcrist
Created September 21, 2016 14:14
Show Gist options
  • Save matthewcrist/8599ec6437ead06180d277755953aa18 to your computer and use it in GitHub Desktop.
Save matthewcrist/8599ec6437ead06180d277755953aa18 to your computer and use it in GitHub Desktop.
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