Replacing HTC Files

I am working on a project that uses HTML Components (.htc) files, now I want to update a project that should work in all browsers with IE10, since htc files are no longer supported by IE10. So please give me a decision how we can convert the part of the project where we use htc files. see below code:

this.Style.Add("BEHAVIOR", "url(xyz.htc)");

I want to replace this htc file and the code written inside this file. What you need to replace in the htc file.

Please, help.

+4
source share
1 answer

Update .htc (HTML Components) custom attributes for js since IE10 standard mode does not support htc.

:

var Method_Behavior = {
    get: function () {
        return this.style.behavior
    },
    set: function (val) {
        this.style.behavior = val
    }
}

//input
if (!HTMLInputElement.prototype.hasOwnProperty("Behavior")) {
    Object.defineProperty(HTMLInputElement.prototype, "Behavior", Method_Behavior);
}

Html

<script src="new_js_file_name" type="text/javascript"></script>
    <script type="text/javascript">
        function loaded() {
            document.getElementById("Id_Name").Behavior = "new_behavior";
        }
    </script>
+2

Source: https://habr.com/ru/post/1546119/


All Articles