IE title changes to if the page has a url with '#' , and has flash/swf embedded in it

后端 未结 5 805

The issue is, if IE (6.0+) , has flash content embedded in it, and the url of the page has a # somewhere in it, then when the flash content loads ,or if the user interacts with

5条回答
  •  无人共我
    2021-01-31 10:31

    The following workaround is the only way (till now) , that I got nearest to solving the issue:

    var isIE11OrGreater = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
    if (!isIE11OrGreater) {
        var originalTitle = document.title.split("#")[0];    
        document.attachEvent('onpropertychange', function (evt) {
           if(evt.propertyName === 'title' && document.title !== originalTitle) {
            setTimeout(function () {
               document.title = originalTitle;
            }, 1);
        }
    });
    
    }
    
    //Incase the developer wants to change the title manually, instead of directly using     //document.title=newtitle, he will need to use changeTitle(newTitle)
        function changeTitle(newTitle)
        {
            originalTitle = newTitle;
            document.title = newtitle;
        }
    

提交回复
热议问题