Implemented dynamic host for links in mock.html
This commit is contained in:
		| @@ -8,6 +8,7 @@ | |||||||
|     <!-- <link rel="stylesheet" href="css/common.css" type="text/css"> --> |     <!-- <link rel="stylesheet" href="css/common.css" type="text/css"> --> | ||||||
|     <link rel="stylesheet" href="http://localhost:8086/assets/css/mock-service/common.css" type="text/css"> |     <link rel="stylesheet" href="http://localhost:8086/assets/css/mock-service/common.css" type="text/css"> | ||||||
|     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> |     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||||||
|  |     <script src="../js/dyn_host.js"></script> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|     <div class="container"> |     <div class="container"> | ||||||
|   | |||||||
| @@ -0,0 +1,25 @@ | |||||||
|  | // $(document).ready( function() { | ||||||
|  | //     console.log("Here") | ||||||
|  | //     let links = document.getElementsByTagName("link") | ||||||
|  | //     for (let e in links) { | ||||||
|  | //         let oldStr = links[e].href.split("/") | ||||||
|  | //         console.log(oldStr) | ||||||
|  | //         let endpoint = oldStr.slice(3).join() | ||||||
|  | //         console.log(endpoint) | ||||||
|  | //         e.href = window.location.protocol + "//" + window.location.hostname + "/" + endpoint | ||||||
|  | //     } | ||||||
|  | // }); | ||||||
|  |        | ||||||
|  | $(document).ready( function() { | ||||||
|  |     console.log("Here") | ||||||
|  |     let links = document.getElementsByTagName("link") | ||||||
|  |     for (let i = 0; i < links.length; i++) { | ||||||
|  |         let oldStr = links[i].href.split("/") | ||||||
|  |         console.log(oldStr) | ||||||
|  |         let endpoint = oldStr.slice(3).join("/") | ||||||
|  |         console.log(endpoint) | ||||||
|  |         links[i].href = window.location.protocol + "//" + window.location.hostname + ":8086/" + endpoint | ||||||
|  |     } | ||||||
|  |      | ||||||
|  | }); | ||||||
|  |        | ||||||
		Reference in New Issue
	
	Block a user