OSX Safari Frame Load Interrupted

前端 未结 2 1192
遥遥无期
遥遥无期 2021-01-17 09:16

I have a basic HTML website (with some javascript) using a simple anchor tag to download a file like so:



        
2条回答
  •  旧时难觅i
    2021-01-17 10:14

    If you always want to get the ga event then the hitCallback is likely the only way to go until whatever is wrong with Safari is fixed. I use a similar pattern to send a GA event from a page in an app which is just a redirect after a whole load of database stuff has been executed in rails. There is no noticeable lag from adding the javascript redirect into the callback. However I am not sure how to initiate the download from javascript off the top of my head.

    ga('send','event','Download','MexmlSample','MexmlSample-1.0', {
       hitCallback: function(){
       initiateDownload();
       })
    

    I am not aware of any need to use the setTimeout() for pattern in this instance.

提交回复
热议问题