Answer the question
In order to leave comments, you need to log in
Mysterious behavior of .css and .js resource references
Hello!
I am making an extension for chrome.
I decided to make a link to my site in a pop-up window.
For example:
<a href="http://site.ru/any.php/" target="_blank">Сайт</a>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
http://site.ru/any.php/css/bootstrap.min.css
Answer the question
In order to leave comments, you need to log in
And why, in fact, this behavior is mysterious to you? Here, in my opinion, everything is simple - the links are relative, which means they are taken relative to the current path (pay attention to the last slash in the link). To avoid this without specifying absolute references, you can use the base tag
replace with references relative to the root
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
There is a simple rule: all URLs must be absolute. Many more complement: absolute and complete.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question