清单:在加载时调用hint()

时间:2019-05-17 04:20:59

标签: javascript php web-applications manifest

我尝试在installprompt之后立即在加载时调用hint(),但是出现错误。

  

未捕获的TypeError:无法读取未定义的属性“提示”

这是我的index.js

With wd.ActiveDocument.Tables(c)
  For r = 1 To .Rows.Count
    With .Cell(r, 1)
      If InStr(.Range.Text, "Job") = 1 Then
        .Range.Font.AllCaps = True
        .Row.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
      End If
    End With
  Next
End With

我还尝试在 let deferredPrompt; var btnAdd = document.getElementById("btnAdd"); window.addEventListener('beforeinstallprompt', (e) => { // Prevent Chrome 67 and earlier from automatically showing the prompt e.preventDefault(); // Stash the event so it can be triggered later. deferredPrompt = e; // Update UI notify the user they can add to home screen btnAdd.style.display = 'block'; }); window.addEventListener("load", function(){ deferredPrompt.prompt(); }); 之后立即致电deferredPrompt.prompt();,但我却得到并出错

  

未捕获的DOMException。

我只想在加载页面后显示提示,因此用户无需单击另一个按钮即可安装PWA。

0 个答案:

没有答案