I am developing a simple PHP script to grab the real link from a website while the real link/key is hidden using javascript:void(0)
method I tried to analyze the view source code but it shows the herf link empty and replaced with # sign
but when I show the code using inspect elements it appears correctly as following
<td valign="middle" align="left">
<span class="post_version_link">
<a href="javascript:void(0)" class="embed-link popper" link_version="1" open-text="Close" close-text="Version 3" key="2Q6tiz7">Version 3</a>
(<a href="/links/go/2Q6tiz7" class="propper-link popper" link_version="1" rel="nofollow" target="_blank" onclick="trackOutboundLink('example.com');" key="2Q6tiz7">Direct</a>)
</span>
</td>
In view source or PHP grab, the code appears as following
<td align="left" valign="middle">
<span class="post_version_link">
<a href="javascript:void(0)" class="embed-link popper" link_version="1" open-text="Close" close-text="Version 3">Version 3</a>
(<a href="#" class="propper-link popper" link_version="1" rel="nofollow" target="_blank" onclick="trackOutboundLink('example.com');">Direct</a>)
</span>
</td>
Update1: There is an event listener Javascript on that herf link
function(t) {
return "undefined" != typeof ke && ke.event.triggered !== t.type ? ke.event.dispatch.apply(e, arguments) : void 0
}
You can leave the href
as blank or as #
. You can then redirect the click to a specific URL. Example:
$(function() { function go(e) { e.preventDefault(); window.location.href = "/links/go/" + $(e.target).attr("key"); } $(".embed-link").click(go); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <td valign="middle" align="left"> <span class="post_version_link"> <a href="#" class="embed-link popper" link_version="1" open-text="Close" close-text="Version 3" key="2Q6tiz7">Version 3</a> </span> </td>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.