苹果微信iframe标签内图片无法长按识别二维码

有个人给我发了串js代码,说可以解决,不知道怎么使用,

<script>
setTimeout(function(){
  $('img').on('touchstart',function(){
           var url=$(this).attr("src");
           if(url.indexOf("http")==-1 && url.indexOf("data:")==-1){
               url=document.location.protocol+"//"+document.location.host+"/"+url; 
        }
            
       window.parent.postMessage(JSON.stringify({state:1,url:url}), '*');
    })
 
 
},2000)
 
</script>

求高手来个例子

https://blog.csdn.net/webjhh/article/details/88954498

这不是我写的代码么 。。。。。

我之前在防封网站 给别人对接接口的时候 发的这

他网站二维码加载的慢 所以需要用定时炸弹处理

然后呢 你这个是子站点 配置的东西 父站点也需要配置接收