1

I have a site which is running in 3 web servers and it is accessed via load balanced URL. The site has a code to display web server name something like this <!-- Machine Name= WEBSERVER1 --> (in case the site is accessed from web server1), in case of web server2 it would be <!-- Machine Name= WEBSERVER2--> I can find where the site is running by doing view source and searching for machine name text. However i was wondering if i could create a bookmarklet which when clicked would give me the machine name.

Does anyone know if that is even possible?

Thanks.

4

1 回答 1

1

在您的服务器端代码中添加如下内容:

<script>
var SERVER_NAME="server1";
</script>

并在浏览器中:javascript:alert(SERVER_NAME);

这个小书签应该可以工作。

javascript:alert(document.getElementsByTagName('html')[0].innerHTML.match(/Machine Name= (.*?)-->/)[1])
于 2013-05-02T00:44:19.577 回答