mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
html sanitize
Added a function to sanitize the html This is for browser side only.
This commit is contained in:
parent
a6ac902bf4
commit
86e1ba871f
@ -147,6 +147,14 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function sanitizeHTMLEntities (str) {
|
||||||
|
if(str && typeof str === 'string') {
|
||||||
|
str = str.replace(/</g,"<");
|
||||||
|
str = str.replace(/>/g,">");
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
function httpGet(theUrl) {
|
function httpGet(theUrl) {
|
||||||
var xmlHttp = new XMLHttpRequest();
|
var xmlHttp = new XMLHttpRequest();
|
||||||
xmlHttp.open("GET", theUrl, false); // false for synchronous request
|
xmlHttp.open("GET", theUrl, false); // false for synchronous request
|
||||||
@ -169,7 +177,8 @@
|
|||||||
lastRequest.open("GET", theUrl, true);
|
lastRequest.open("GET", theUrl, true);
|
||||||
lastRequest.onload = function (e) {
|
lastRequest.onload = function (e) {
|
||||||
if (lastRequest.readyState === 4 && lastRequest.status === 200) {
|
if (lastRequest.readyState === 4 && lastRequest.status === 200) {
|
||||||
let httpResults = JSON.parse(lastRequest.responseText);
|
let sanitizedResponseText = lastRequest.responseText;
|
||||||
|
let httpResults = JSON.parse(sanitizedResponseText);
|
||||||
results.innerHTML = '';
|
results.innerHTML = '';
|
||||||
|
|
||||||
let processingTimeMs = httpResults.processingTimeMs;
|
let processingTimeMs = httpResults.processingTimeMs;
|
||||||
|
Loading…
Reference in New Issue
Block a user