I'm looking for a way d开发者_如何学Goo differ between relative and non-relative links on an html page.
What defines all non-relative links? I'm looking for some sort of regular expression.
for example, do all non-relative links contain ://
and relative links never display it?
Absolute across the internet start with http://
or https://
(or whatever other scheme they may be using. I guess you could "contains" ://
as you said).
Hrefs starting with a slash (/
) are both absolute from and relative to the web-server path
Paths starting with letters/numbers/symbols or ../
are relative to the page's file path, with ../
meaning "next folder up".
精彩评论