title: Different Behavior in Chrome on a Chromebook(works as expected) vs Safari on iOS(javascript function not found when trying to call it)?(HTML,JS)
body: <p>First off, I know this code is kind of messy, I will clean it up, I just wanted a working prototype. It works great on my chromebook, but main use case for what I am making will be mobile.</p>
  <p>I have code that in chrome on my chromebook using an eventlistener calls a function inside a script. On Safari iOS i get in the console &quot;reference error: cant find variable: Generate&quot;</p>
  <p>Generate is the function i am calling. The question is why does Safari not see the function?
  Here is the JS with issue:</p>
  <pre><code>&lt;script type=&quot;module&quot;&gt;
  
  import { fillForm } from 'https://storage.googleapis.com/paperworker/pdfconvert.mjs';
  document.getElementById('submit').addEventListener('click', Generate)
  
  function Generate() {
      fillForm();
      var serviceDate = document.getElementsByName(&quot;TodayDate&quot;)[0].value;
      var ticketNumber = document.getElementsByName(&quot;TicketNumber&quot;)[0].value;
      var comTypeCS = false;
      var comTypeMB = false;
      var serTypeNotif = false;
      var serTypeServ = false;
      var serTypeShut = false;
      var serTypeStand = false;
      var serTypeRe = false;
      var serTypeDrill = false;
      var serTypeInstall = false;
      var serTypeInspection = false;
      var workTypeReg = false;
      var workTypeOT = false;
      var wrapTypeComplete = false;
      var wrapTypeAdditional = false;
      var wrapTypeRecommend = false;
      var AccountName = document.getElementsByName(&quot;Account&quot;)[0].value;
      var Address = document.getElementsByName(&quot;Address&quot;)[0].value;
      var City = document.getElementsByName(&quot;City&quot;)[0].value;
      var serviceTime = document.getElementsByName(&quot;ScheduleTime&quot;)[0].value;
      var ComAccountNum = document.getElementsByName(&quot;ComAccountNumber&quot;)[0].value;
      if (document.getElementsByName(&quot;ComAccountType&quot;)[0].checked == true) {comTypeCS = true;}
      if (document.getElementsByName(&quot;ComAccountType&quot;)[1].checked == true) {comTypeMB = true;}
      var Operator = document.getElementsByName(&quot;Operator&quot;)[0].value;
      if (document.getElementsByName(&quot;ServiceType&quot;)[0].checked == true) {serTypeNotif = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[1].checked == true) {serTypeServ = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[2].checked == true) {serTypeShut = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[3].checked == true) {serTypeStand = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[4].checked == true) {serTypeRe = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[5].checked == true) {serTypeDrill = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[6].checked == true) {serTypeInstall = true;}
      if (document.getElementsByName(&quot;ServiceType&quot;)[7].checked == true) {serTypeInspection = true;}
      var Report = document.getElementsByName(&quot;Report&quot;)[0].value;
      //store signature
      //var canvas = document.getElementById('signature-pad');
      //var dataURL = canvas.toDataURL(&quot;image/jpeg&quot;, 1.0);
      var dispatchTime = document.getElementsByName(&quot;DispatchTime&quot;)[0].value;
      var startTime = document.getElementsByName(&quot;StartTime&quot;)[0].value;
      var endTime = document.getElementsByName(&quot;EndTime&quot;)[0].value;
      var travelTime = document.getElementsByName(&quot;TravelTime&quot;)[0].value;
      var siteTime = document.getElementsByName(&quot;SiteTime&quot;)[0].value;
      var totalTime = document.getElementsByName(&quot;TotalTime&quot;)[0].value;
      var techOne = document.getElementsByName(&quot;Tech1&quot;)[0].value;
      var techOneNum = document.getElementsByName(&quot;Tech1Num&quot;)[0].value;
      var techTwo = document.getElementsByName(&quot;Tech2&quot;)[0].value;
      var techTwoNum = document.getElementsByName(&quot;Tech2Num&quot;)[0].value;
      if (document.getElementsByName(&quot;WorkType&quot;)[0].checked == true) {workTypeReg = true;}
      if (document.getElementsByName(&quot;WorkType&quot;)[1].checked == true) {workTypeOT = true;}
      if (document.getElementsByName(&quot;Wrapup&quot;)[0].checked == true) {wrapTypeComplete = true;}
      if (document.getElementsByName(&quot;Wrapup&quot;)[1].checked == true) {wrapTypeAdditional = true;}
      if (document.getElementsByName(&quot;Wrapup&quot;)[2].checked == true) {wrapTypeRecommend = true;}
      var dataStore = AccountName + &quot;\n&quot; + Address + &quot;\n&quot; + City + &quot;\n&quot; + serviceDate + &quot;\n&quot; + serviceTime + &quot;\n&quot;
      + ticketNumber + &quot;\n&quot; + ComAccountNum + &quot;\n&quot; + comTypeCS + &quot;\n&quot; + comTypeMB + &quot;\n&quot; + Operator + &quot;\n&quot; + serTypeNotif + &quot;\n&quot; + serTypeServ + &quot;\n&quot; + serTypeShut + &quot;\n&quot; + serTypeStand + &quot;\n&quot; + serTypeRe + &quot;\n&quot;
      + serTypeDrill + &quot;\n&quot; + serTypeInstall + &quot;\n&quot; + serTypeInspection + &quot;\n&quot; + Report + &quot;\n&quot; + dispatchTime + &quot;\n&quot; + startTime + &quot;\n&quot; + endTime + &quot;\n&quot;
      + travelTime + &quot;\n&quot; + siteTime + &quot;\n&quot; + totalTime + &quot;\n&quot; + techOne + &quot;\n&quot; + techOneNum + &quot;\n&quot; + techTwo + &quot;\n&quot; + techTwoNum + &quot;\n&quot; + workTypeReg + &quot;\n&quot; + workTypeOT + &quot;\n&quot; + wrapTypeComplete + &quot;\n&quot; + wrapTypeAdditional + &quot;\n&quot;
      + wrapTypeRecommend;
      var c = document.createElement(&quot;a&quot;);
      c.download = &quot;dataStore&quot; + ticketNumber;
      var t = new Blob([dataStore], {
      type: &quot;text/plain&quot;
      });
      saveAs(t, &quot;dataStore for &quot; + serviceDate + &quot; TN-&quot; + ticketNumber)
      //FillForm()
      /*var d = document.createElement(&quot;b&quot;);
      d.download = &quot;serviceReport&quot; + ticketNumber;
      var y = new Blob([pdfBytes], {
      type: &quot;application/pdf;charset=utf-8&quot;
      });
      saveAs(t, &quot;serviceReport for &quot; + serviceDate + &quot; TN-&quot; + ticketNumber);*/
   }
  </code></pre>
  <p>I have tried changeing where in the index.html i put the script to no avail</p>