![](/img/trans.png)
[英]How can I use either PHP or JavaScript to display the contents of the description meta tag in the body text of a web page?
[英]How can I use Javascript to display text from another web page onto a different page?
我有一个网站,称其为abc.com。 我需要自动从另一个名为static.abc.com/pluginchangelog.txt的页面检索文本,并在abc.com/plugin的该页面顶部显示文本。
我是Java的新手。 我已经搜索了,但是还没有找到确切的答案。 我找到了此页面, Javascript访问了另一个页面 ,但是我不确定如何实现此功能以实现所需的用途。 即使我能弄清楚那部分,我也不知道如何将文本插入页面的HTML中。
我将不胜感激!
使用提取获取文本
然后根据需要编辑页面上的内容
fetch("https://example.com/pluginchangelog.txt", {credentials: "omit"}).then(resp => resp.text()).then(text => { // do anything you want with text content.innerText = text })
<html> <body> <p id="content"/> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.