Internet Explorer 7 - Javascript Error

Topics: Bugs, DocSites, General Questions
Jun 20, 2008 at 4:22 PM
Hi, everybody.

I'm having the conversation with Dave Sexton (Thanks Dave) as follows:

First of all I'd like to thank you for this really useful tool.

I just created a DocSite Project today with 10 conceptual topics. To
project works fine with the Mozilla Firefox 3.0, but with Internet
Explorer 7, the tree view on the left side of the html help does not
display properly. I did not test this issue with Internet Explorer 6.

I have Visual Studio 2008 Team Edition and just downloaded the latest
Sandcastle and DocProject version.

What Do I have to do?

--

Dave replied this e-mail with the following message

Hi Sergio,

When you say that the tree doesn't display properly, what do you mean
exactly?  Could you please send a screenshot?

--

Then I sent to him two screenshots, including the one with the IE javascript error.

--

He replied again with the following message:

I noticed in the IE7 screenshot that it looks like an older template, which is strange.
 
Would you mind sending me the project?  (I don’t need the source project – just the DocSite)
 
--

Then I sent to him the whole solution and he replied

Hi Sergio,
 
I can’t reproduce the problem.
 
I noticed that the project already contained HTML files generated by Sandcastle and also the App_Data files generated by DocProject, so instead of rebuilding everything I opened the project file and changed the default target from Build to BuildBase, which will cause MSBuild to use the normal build process instead of DocProject’s.
 
Then I opened the solution, right-mouse clicked Default.aspx and selected View in Browser.  (This causes a build in the background, but since I changed the default target to BuidBase, none of DocProject’s output files were replaced by a new help build.)
 
The result in IE7 is that it looks and works as it should.  I see the tree view and the tool bar and they both function properly.
 
Try viewing the site in IE7 again and then press Alt to show the main menu; then select View > Source and send me the text file please.  I’ll compare it to mine to see if anything is different.
 
Thanks,
Dave

--

Then I sent this last message

Hi Dave,
 
I just press ctrl + F5 to build and excute the project. Visual Studio 2008 instanciates the ASP Net Development Server on port 2712 and opens the help in my default browser wich is the Mozilla Firefox 3.0. I've changed the default browser to Internet Explorer 7 and did what you told me in the previus e-mail. The same error came up.
 
I'm sending you the error message and the html code of my page (ViewSource). Please, rename the file to .zip instead of .zip2.
 
Line: 215
Char: 3
Error: Element not foud
Code: 0
URL: http://localhost:2712/Default.aspx
 
My IE 7 version is: 7.0.5730.11 Update Versions: 0; 3283

--

I did not solve the problem yet. Can you help me?

Thanks in advance.

[]'s,

Sérgio Ciglione









Jun 23, 2008 at 6:48 PM
Hi Dave,

I can't use Gmail right now, so I Will post here, ok?

I was trying to debug the problem, so I discovered where the problem is and made a workaround. The problem is in the DocSiteScript.js in the function:

function initializeTocButtons()
{
  var windowFrames = (document.frames) ? document.frames : window.frames;
 
  if (windowFrames.length == 0)
  // TOC buttons can only be used when an iframe is in the content area
  {
    document.getElementById("toc_email_container").style.display = "none";
    return;
  }
  try
  {   
  if (window.external && "AddFavorite" in window.external)
    document.getElementById("toc_bookmark_container").style.display = "inline";

  if (window.print)
    document.getElementById("toc_print_container").style.display = "inline";
//  try
//  {    
    if (document.queryCommandSupported && document.queryCommandSupported("SaveAs"))
      document.getElementById("toc_save_container").style.display = "inline";
  }
  // Firefox throws an exception, presumably because the document is not
  // in design mode.
  catch (e) {}
}

I just included in the try block the following code:

  if (window.external && "AddFavorite" in window.external)
    document.getElementById("toc_bookmark_container").style.display = "inline";

  if (window.print)
    document.getElementById("toc_print_container").style.display = "inline";

The error does not appear anymore and neither does the print button : ( 

The error was in the "  if (window.external && "AddFavorite" in window.external)" statement.

Do you have any ideas?

Thanks in advance.

[]'s,

Sérgio Ciglione

Jun 23, 2008 at 6:55 PM
Hi Dave,

I've just inverted the order of the statements and put the problematic statement at the bottom of the block and I solved the print button not displaying issue. The real problem must be in the Add to bookmark button.

Thanks,

Sérgio Ciglione
Coordinator
Jun 23, 2008 at 9:00 PM
Hi Sergio,

Thanks for the update.  I'll take a closer look at it tonight and get back to you.

For now, my first impression is that something's different with your installation of IE 7 since the script works fine for me.  Perhaps it's a localization issue or you have an Add-In that's changing the way the DocSite's HTML is interpreted?

- Dave