Question

While inspecting the source code of this website: http://www.flipkart.com/ , I found this line <script type="text/javascript+fk-onload"> . I know there are many different mime types for javascript but this one has some added texts that goes over my mind. Could anyone explain the purpose of this extra text and when can it be used?

Was it helpful?

Solution

The +-suffix defines a subtype. They are using it to execute that particular script onload:

FKART.utils.runOnload = function(a) {
    FKART.utils.runSnippet("fk-onload", a)
};
FKART.utils.runSnippet = function(a, c) {
    c = c || "script[type='text/javascript+" + a + "']";
    $(c).each(function() {
        var d = $(this);
        if (d.attr("data-src")) {
            $script(d.attr("data-src"), b.curry(this))
        }
        else {
            b(this)
        }
    });
    function b(d) {
        FKART.utils.evalScript(d.text || d.textContent || d.innerHTML);
        d.type = d.type + "-executed"
    }
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top