Hi I'm building a tracking system for my project and I'm trying to use the ping
attribute, but this attribute not working correctly on localhost
.
Here is my code with PHP
echo "<a href='".$r_url."' ping='/redirect?url=".$r_url."'>";
Can anybody tell me what's wrong with this code?
Based on your post and the information you gave in the comments, you are trying to redirect through the link in the ping
attribute.
In the W3C documentation:
The ping attribute specifies a list of URLs to be notified if the user follows the hyperlink.
Which means that the user is not directly redirected to this URL, instead this happens:
POST
request to the URL in the ping
attributehref
attributeIf you want to redirect through a URL, simply put your redirection URL in the href
attribute:
echo "<a href='/redirect?url=".$r_url."'>";