Google Fusion table map embed not working on iPad
<p>I'm using a map embed from a Google Fusion table, which seems to be working fine on desktop but does not appear on iPad.</p>

<p>I'm not sure how to fix on iPad so I have been using the Chrome extension 'User Agent Switcher' and using device mode in Developer Tools. When I do this I get the console error:</p>

<p>"Uncaught TypeError: Cannot read property 'style' of null"</p>

<p>Does anyone know what is causing this?</p>

<p>Codepen here: <a href="http://codepen.io/anon/pen/KzVLvR" rel="nofollow">http://codepen.io/anon/pen/KzVLvR</a></p>

<pre><code>&lt;meta name="viewport"&gt;&lt;/meta&gt;

&lt;notextile&gt;&lt;style type="text/css"&gt;
#googft-mapCanvas {
  height: 500px;
  margin: 0;
  padding: 0;
  width: 100%;
}
&lt;/style&gt;&lt;/notextile&gt;

&lt;script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&amp;amp;v=3"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;
  function initialize() {
    google.maps.visualRefresh = true;
    var isMobile = (navigator.userAgent.toLowerCase().indexOf('android') &gt; -1) ||
      (navigator.userAgent.match(/(iPod|iPhone|iPad|BlackBerry|Windows Phone|iemobile)/));
    if (isMobile) {
      var metaTag=document.createElement('meta');
metaTag.name = "viewport"
metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
document.getElementsByTagName('head')[0].appendChild(metaTag);
    }
    var mapDiv = document.getElementById('googft-mapCanvas');
    mapDiv.style.width = isMobile ? '100%' : '100%';
    mapDiv.style.height = isMobile ? '100%' : '500px';
    var map = new google.maps.Map(mapDiv, {
      center: new google.maps.LatLng(50.86921697720649, 0.18021480234369847),
      zoom: 10,
      mapTypeId: google.maps.MapTypeId.ROADMAP

    });
    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend-open'));
    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend'));

          var myLatLng = {lat: 50.878353, lng: 0.063805};

    var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    title: 'Glyndebourne',
    icon: 'http://res.cloudinary.com/glyndebourne/image/upload/v1456245664/gicon_afipi7.png'
  });

    layer = new google.maps.FusionTablesLayer({
      map: map,
      heatmap: { enabled: false },
      query: {
        select: "col4",
        from: "1_wBUixHJqO_W95zMHk_eP8wQKBuXvHEfvNgfTBSC",
        where: ""
      },
      options: {
        styleId: 4,
        templateId: 4
      }


    });

    if (isMobile) {
      var legend = document.getElementById('googft-legend');
      var legendOpenButton = document.getElementById('googft-legend-open');
      var legendCloseButton = document.getElementById('googft-legend-close');

// CONSOLE ERROR REFERS TO THIS NEXT LINE:  
      legend.style.display = 'none'; 

      legendOpenButton.style.display = 'block';
      legendCloseButton.style.display = 'block';
      legendOpenButton.onclick = function() {
        legend.style.display = 'block';
        legendOpenButton.style.display = 'none';
      }
      legendCloseButton.onclick = function() {
        legend.style.display = 'none';
        legendOpenButton.style.display = 'block';
      }
    }
  }

  google.maps.event.addDomListener(window, 'load', initialize);
&lt;/script&gt;

&lt;div id="googft-mapCanvas"&gt;&lt;/div&gt;
</code></pre>