Jonathan
Jonathan

Reputation: 191

Browser making unwanted request in script tag

I've been supplied some code from a 3rd party supplier to integrate on some of my webpages, which uses the jQuery plugin for jTemplates. Code looks similar to this:

<script type="text/html" id="item_template">
{#foreach $T.search.results as result}
    {$P.fieldExists($T.result, "thumbnail", "<img src=\"[[VALUE]]\" align=\"left\" border=\"0\">")}
{#/for}
</script>

The problem I've got, is in some web browsers, the browser makes a request for the image you can see in the code and looks like this:

http://localhost/MyWebapp/[[VALUE]]

Except, I think it shouldn't be making the request and I can't figure out if this is a browser defect, or the code is incorrect. I'm assuming because the content type is text/html in the script tag, the browser is parsing it as HTML.

Any insights here would be greatly appreciated.

Upvotes: 1

Views: 142

Answers (1)

chiborg
chiborg

Reputation: 28094

Yes, you are right, the text/html type may be the culprit here. Try x-application/template or text/template or something like that. Also make sure that you have a DOCTYPE, quirks mode may also play a role here.

Upvotes: 0

Related Questions