为什么Facebook使用PHP链接的img标签 [英] Why does Facebook uses the img tag with PHP link

查看:99
本文介绍了为什么Facebook使用PHP链接的img标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试一些东西,当时我发现了以下图像标签:

 < img style = -webkit-user-select:nonesrc =https://pixel.facebook.com/ajax/ego_height.php?sid=ads&amp;fbid=34324234&amp;height=0&amp;asyncSignal=4815& ;安培; __用户= 23232323&放大器;放大器; __一个= 1&放大器;放大器; fb_dtsg = AQCVSss> 

为什么Facebook使用这个 img 标签致电 PHP 文件?

解决方案

这实际上是一个很常见的做法。



由于安全性原因,您无法执行 Ajax 请求到第三方域。而您真的别无选择,只能通过加载图像发送数据,或者加载实际上是服务器端代码的JavaScript代码。或者您可以同时执行(如 Google Analytics(分析)),他们只需加载JavaScript即可处理所有事件页面,并通过加载具有分析参数的像素图像进行注册)。


I was debugging a few things, and at that time I found the following image tag:

<img style="-webkit-user-select: none" src="https://pixel.facebook.com/ajax/ego_height.php?sid=ads&amp;fbid=34324234&amp;height=0&amp;asyncSignal=4815&amp;__user=23232323&amp;__a=1&amp;fb_dtsg=AQCVSss">

Why does Facebook use this img tag for calling a PHP file?

解决方案

That's actually a pretty common practice.

Due security reasons, you're not able to do an Ajax request to a third-party domain. And you really have no choice but sending data by loading an image OR loading JavaScript code which is actually server-side code. Or you can do both (as Google Analytics works, they just load JavaScript which handles all events on the page and register them by loading a pixel image with analytics parameters passed).

这篇关于为什么Facebook使用PHP链接的img标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆