'Why ping attribute not working correctly in html5
Hi I'm building an tracking system for my project and I'm try to use 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 1:[1]
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
POSTrequest to the URL in thepingattribute - The browser redirects the user to the URL in the
hrefattribute
If you want to redirect through a URL, simply put your redirection URL in the href attribute:
echo "<a href='/redirect?url=".$r_url."'>";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
