Replacement of HTC files

2.8k Views Asked by At

I am working on a project which is using HTML Components files (.htc), now i want to upgrade the project that should work on all the browsers with IE10, as htc files are no longer supported by IE10. So Please give me solution how we can convert the part of project where we are using htc files. please refer below code:

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

I want to replace this htc file and code written inside this file. What should needs to be put in replacement of htc file.

Please help.

1

There are 1 best solutions below

7
On

Update .htc (HTML Components) custom attributes to js since IE10 standard mode doesn't support htc.

Check this link

Edit :

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);
}

Then in the Html page

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