I strungle with this, in resume I'm using axios to get a directory content of a remote server in other network. The path of the directory in that server is : enter image description here

my front response.data is like this: enter image description here

我使用的是div和

document.getElementById('content').innerHTML = response.data; 

在.get函数内部,加载包含的所有html de‘a’标记,但href发生了更改.

Now is like this: enter image description here

因此,问题是它将href从192.168.110.83:8080/sign/更改为localhost:8080/

我如何才能保持原始的HREF?或者是不可能做到的?

推荐答案

您可以管理原始HREF,如下所示:

const htmlContent = response.data.replace(/http:\/\/192\.168\.110\.83:8080\/signed\//g, '/signed/');
document.getElementById('content').innerHTML = htmlContent;

Javascript相关问答推荐

在HTML中使用脚本变量作为背景图像源

如何提取Cypress中文本

ReactJS中的material UI自动完成类别

Plotly热图:在矩形上zoom 后将zoom 区域居中

有没有可能使滑动img动画以更快的速度连续?

当试图显示小部件时,使用者会出现JavaScript错误.

使用GraphQL查询Uniswap的ETH价格

这个值总是返回未定义的-Reaction

如何修复我的数据表,以使stateSave正常工作?

查询参数未在我的Next.js应用路由接口中定义

当我try 将值更改为True时,按钮不会锁定

在SHINY R中的嵌套模块中,不能使用Java代码

如何防止ionic 输入中的特殊字符.?

令牌JWT未过期

使用自动识别发出信号(&Q)

如何在下一个js中更改每个标记APEXCHARTS图表的 colored颜色

如何在Reaction中清除输入字段

我无法在Api Reaction本机上发出GET请求

我如何才能获得价值观察家&对象&S的价值?

KeyboardEvent:检测到键具有打印的表示形式