开发者

What defines all non-relative links?

开发者 https://www.devze.com 2023-02-22 05:17 出处:网络
I\'m looking for a way d开发者_如何学Goo differ between relative and non-relative links on an html page.

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消