No. of hops to a website using JavaScript
Is it possible to count the number of hops to a website 开发者_JAVA百科using javascript (in browser javascript) ?
where hop count : the number of hops a packet has taken toward its destination.
if no ? what are the other options that i have ?
No.
Well, technically I guess one could use an ActiveX control with JavaScript.... but... no.
Edit: I assumed you meant in-browser JS. If it's server-side JS then the same applies: "technically" if you have access to the appropriate library/program/API with such low-level network access. But, generally (and insofar as JavaScript itself) no.
As several people have already mentioned, there is no pure javascript way to do this.
However, if you really want this type of functionality on a webpage, you could simply use javascript to load a server side page (perhaps through AJAX), and use a server side programming language to do all the heavy lifting
An example server side language, could be PERL, as there is a 'traceroute' library. The library page also has an example to get you started
精彩评论