Issue
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?
Solution
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:
- User clicks on the link
- The browser sends a
POST
request to the URL in theping
attribute - The browser redirects the user to the URL in the
href
attribute
If you want to redirect through a URL, simply put your redirection URL in the href
attribute:
echo "<a href='/redirect?url=".$r_url."'>";
Answered By - Noah Boegli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.