Bookmark links not working when using latest IE version

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
flashk
Propeller Head
Posts: 13
Joined: Tue Jul 30, 2013 6:48 pm

Bookmark links not working when using latest IE version

Post by flashk »

I've added the following meta tag to the head section of my CHM master page in order to use the latest IE rendering engine:

Code: Select all

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
However, I noticed that this causes bookmark links to fail when referencing a different page. When a bookmark link is clicked, it will jump to the bookmarked position within the new page for a split second, but then jump back to the top of the page. When linking within the same page, the bookmarks work fine.

Is there anyway to work around this issue without reverting back to the old IE rendering engine?
flashk
Propeller Head
Posts: 13
Joined: Tue Jul 30, 2013 6:48 pm

Re: Bookmark links not working when using latest IE version

Post by flashk »

I've looked into this issue a little further and I believe the cause of this behavior is from the FMCCheckForBookmark function in MadCapBody.js. Specifically, this portion of code:

Code: Select all

if ( navigator.userAgent.Contains( "MSIE 7", false ) )
{
    // IE 7 bug: Older builds of IE 7 have the following bug: if you create an iframe who's URL has a bookmark and the iframe's opacity has been set,
    // the document won't scroll to the bookmark. It seems to be a render issue because scrolling the document in the iframe causes it to jump down to
    // the bookmark and scroll from there. The hack workaround is to cause the iframe to redraw after the document has loaded, which is done here.

    window.setTimeout( function()
    {
        document.body.style.display = "none";
        document.body.style.display = "";
    }, 1 );
}
If I remove this code then the bookmarks work properly. Although the meta tag is requesting the latest version of the IE rendering engine (IE 11 in my case), the navigator.userAgent string seems to always report MSIE 7.0. Apart from modifying the MadCapBody.js file included with Flare, is there another (preferably less hacky) solution to this?
flashk
Propeller Head
Posts: 13
Joined: Tue Jul 30, 2013 6:48 pm

Re: Bookmark links not working when using latest IE version

Post by flashk »

On further investigation, there appears to be a document.documentMode attribute in IE browsers that specifies which version of the rendering engine is being used. Perhaps this could be used in the code above to verify that IE 7 rendering engine is actually being used. As a quick test I tried the following and it fixed my issue:

Code: Select all

if ( navigator.userAgent.Contains( "MSIE 7", false ) && document.documentMode == 7)
{
    ....
}
Post Reply