Nee*_*raj 24 browser flash jquery internet-explorer-8 internet-explorer-7
问题是,如果IE(6.0+)中嵌入了flash内容,并且页面的url中有一个#where,那么当加载flash内容时,或者如果用户与之交互,则标题为窗口,更改散列后的内容.
例如http://adobeflashwebsite.com/index.html#somediv
然后页面标题变为'somediv',用户点击flash内容的时刻,或者甚至闪存内容加载的那一刻.
以下是我面临的一个非常具体的案例:
以下是我面临的问题:
这里的问题是,无论我尝试嵌入闪存的哪个插件,我最终都遇到以下问题
有人可以建议,问题可能是什么?最有可能的是它与sammy.js有关,因为iGoogle没有这个问题.
Nee*_*raj 18
以下解决方法是唯一的方法(到现在为止),我最接近解决问题:
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;
}
Run Code Online (Sandbox Code Playgroud)
这是IE错误:
如果你使用sammy的title方法,你可以延迟执行一点,使其在IE上运行.
setTimeout(function() {
context.title('Some title');
}, 1000);
Run Code Online (Sandbox Code Playgroud)
这不会真的解决它,但我注意到有点延迟有助于IE.