Qyouu
如果您尝试在浏览器中执行此操作,您可以获取url 并使用include来检查您要查找的字符串:async function responseContains(url, string) { try { const content = await fetch(url).then(response => response.text()); return content.includes(string); } catch (e) { console.log(e); throw e; }}const url = 'https://jsonplaceholder.typicode.com/todos/1';/* the url above returns: { "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false }*/responseContains(url, 'userId') .then(found => console.log(`Found 'userId'? ${found}`));// Found? trueresponseContains(url, 'wookies with bananas') .then(found => console.log(`Found 'wookies with bananas'? ${found}`));// Found? false