Relative URL to a different port number in a hyperlink?

前端 未结 11 1854
心在旅途
心在旅途 2020-11-27 15:13

Is there a way without Javascript / server-side scripting to link to a different port number on the same box, if I don\'t know the hostname?

e.g.:

&l         


        
11条回答
  •  温柔的废话
    2020-11-27 16:19

    No need of complicated javascript : simply insert a script node after your anchor, then get the node in javascript, and modify its href property with the window.location.origin method.

     Look at the other port
     
    

    The id property must be unique page wide, so you may want to use other method to retrieve node objects.

    Tested with apache and Firefox on Linux.

提交回复
热议问题