David Culp
David Culp

Reputation: 5480

HTML relative URL resolution difference

I am looking at an older asp.net 2.0 web application. In the master page, there are the following tags:

<link href="style/template.master.css" rel="stylesheet" />
<script src="js/prototype.js" type="text/javascript"></script>

When I saw this, I expected some trouble with pages loading from folders within the site. I was not expected there to be a difference in how the relative URLs are being resolved. Below is a screenshot of the resolved URLs from a page in the Admin folder:

enter image description here

I expected the URLs to both be resolved relative to the Admin folder; but as can be seen, the URLs resolved differently. My question is why?

An explanation is fine, but I would really like a reference of the resolution rules that state the difference -- or of a bug that could causing this.

A bit more info:

There are no base tags in either the admin page or master page.

The behavior is the same in both IE 11 (in various compatibility modes) and Chrome 40.

The master page has an XHTML 1.0 Strict doc type.

Thanks

Upvotes: 2

Views: 136

Answers (1)

Peter Hahndorf
Peter Hahndorf

Reputation: 11222

The head section in master pages usually have a runat="server" attribute and there is an 'Automatic URL Resolution in the <head> Section', this fixes the URLs for any link tags, but not for the script tags.

Why? don't know. Here's an article about URLs in Master Pages.

For a reference, you could look at the source, now that asp.net is open source.

Upvotes: 2

Related Questions