修复 JS 中的内部链接
我刚刚创建了一个脚本,通过服务器端 JS 从网页中提取文章。 (如果您感兴趣:它用于 http://pipes.yahoo.com/fb55/expandr .)
我刚刚在内部链接方面遇到了一点问题。有些页面包含如下链接:
/subfolder/subpage.html
我需要做的是修复它们并设置根目录,如下所示:
protocol://secondlevel.firstlevel/subfolder/subpage.html
我正在使用 E4X 来处理页面。我不想展示我目前令人毛骨悚然的尝试,它有问题而且速度很慢。有人能为我提供解决方案吗?
I just created a script which extracts the article out of a webpage via server-side JS. (If your interested: it's used for http://pipes.yahoo.com/fb55/expandr .)
I just got a little problem with internal links. Some pages include links like:
/subfolder/subpage.html
What I would need to do is fixing them and setting there root, like this:
protocol://secondlevel.firstlevel/subfolder/subpage.html
I'm using E4X for processing the page. I don't want to show my current creepy try, it's buggy and slow. Does anybody have a solution for me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用一些正则表达式重写它们:
You may be able to rewrite them with some Regular Expression: