We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

חיפוש בתמיכה

יש להימנע מהונאות תמיכה. לעולם לא נבקש ממך להתקשר או לשלוח הודעת טקסט למספר טלפון או לשתף מידע אישי. נא לדווח על כל פעילות חשודה באמצעות באפשרות ״דיווח על שימוש לרעה״.

מידע נוסף

What standard, if any, specifies how a browser responds to a content type specified by the "type" attribute of the anchor tag?

more options

I had hoped that the following HTML code would FORCE the browser responding to the anchor by treating the content as plain text: <a href="file:path" type="text/plain">anchor text</a>. Likewise: <a href="file:path" type="text/html">...</a> should FORCE the browser to treat the responding reference as HTML code. Firefox does this (good for you!). However, Google Chrome and Internet Explorer seem to ignore the given content type and treat the response according to however they feel (which seems to be according to the file extension). I was hoping to find a standard that describes how a browser handles a source-specified content type. I have looked at W3C's html and http standards and have yet to find any applicable description or requirement. Obviously I am looking for some way to code the source file so that when anchors are followed, they are displayed as I want them to be. I can not change the destination file content (or name) -- that is already determined by its own needs.

I had hoped that the following HTML code would FORCE the browser responding to the anchor by treating the content as plain text: <a href="file:path" type="text/plain">anchor text</a>. Likewise: <a href="file:path" type="text/html">...</a> should FORCE the browser to treat the responding reference as HTML code. Firefox does this (good for you!). However, Google Chrome and Internet Explorer seem to ignore the given content type and treat the response according to however they feel (which seems to be according to the file extension). I was hoping to find a standard that describes how a browser handles a source-specified content type. I have looked at W3C's html and http standards and have yet to find any applicable description or requirement. Obviously I am looking for some way to code the source file so that when anchors are followed, they are displayed as I want them to be. I can not change the destination file content (or name) -- that is already determined by its own needs.

פתרון נבחר

Hi asicchecker, regarding what is "required", did you follow Gingerbread Man's links?

These are more direct:

HTML 4.01: http://www.w3.org/TR/html401/struct/links.html#h-12.2

HTML5: http://www.w3.org/TR/html5/links.html#attr-hyperlink-type (same)

MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-type

Read this answer in context 👍 1

כל התגובות (5)

more options

asicchecker wrote:

Google Chrome and Internet Explorer seem to ignore the given content type and treat the response according to however they feel (which seems to be according to the file extension).

Is your server not sending a Content-Type header? Does the document lack a meta content-type tag? Either of those could take precedence over the link's type attribute.

asicchecker wrote:

I have looked at W3C's html and http standards and have yet to find any applicable description or requirement.
more options

My Server is my browser (which I would also claim is my Client). When using a File scheme of the URI, the file requester (the browser when I click on an anchor) has no other http entity to from which to request the file. The browser gets the file locally from the operating system, and "returns" the file to itself. The same browser then renders the returned file according to some rule (including content type).

Perhaps the browser is supposed to send a Content-Type header to its own child process. If so, how could I tell?

more options

With a local file, there is no server response header to tell the browser what content-type the file is, so the browser has to use the extension name for that.

more options

Clearly, the browser does not "have to" use the extension. Firefox does not. Since Firefox (and any other browser) already "knows" that the anchor has been given a content-type, it can use that given type -- although some other browsers choose not to. Further, my question is whether or not this is required by some HTTP/HTML/Browser/URI/MIME standard (and if so, where).

more options

פתרון נבחר

Hi asicchecker, regarding what is "required", did you follow Gingerbread Man's links?

These are more direct:

HTML 4.01: http://www.w3.org/TR/html401/struct/links.html#h-12.2

HTML5: http://www.w3.org/TR/html5/links.html#attr-hyperlink-type (same)

MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-type