Dave Calkins

We developed an application which uses HTML/Javascript for the main user
interface. We generate the HTML/Javascript using C++ code and then feed it
to the embedded IE MFC control for rendering.

This app was developed with IE6 and works fine in that environment.

We recently upgraded some of our machines to IE7 and now when we run and the
page renders in the embedded IE window, we get script errors. The errors we
see are shown below.

1) Line: 1, Error: Invalid character
2) Line: 9, Error: 'CalendarPopup' is undefined

The first error is a bit confusing, since if you view the source the first
line is just <html>. I thought perhaps it wanted a valid <!DOCTYPE ...>
header so I added that, but the error was still there.

The second error is odd as well, since the CalendarPopup is brought in by
importing a .js file using something like the below. Under IE6 this worked
fine and pulled in the definition.

<script language="javascript" type="text/javascript"

=> Any idea how to correct these script errors

=> Is there any way to uninstall IE7 and revert back to IE6 I can't seem
to find any way to uninstall IE7; if I can't fix these errors, I'll need to move back to IE6


Re: Internet Explorer Web Development HTML/Javascript errors with IE7

Dave Calkins

Looks like uninstalling IE7 is fairly easy. I was looking in the wrong place. Its listed under "Windows Internet Explorer 7" in the Add/Remove Programs control panel. After uninstalling, our app works again.

Anyway, we're going to have to eventually fix these script errors. Any ideas

Re: Internet Explorer Web Development HTML/Javascript errors with IE7

Mathieu Perceau


Is the source a local file
Did you try to access the file with an url, for example src="http://domain/path/CalendarPopu.js"
Or maybe you can try a relative link, with the js file in the same folder as the geerated web page.
Mathieu Perceau

Re: Internet Explorer Web Development HTML/Javascript errors with IE7


I too am having these errors.

There appears to be a max script length that IE7 will read.

In our case we had a very large array in javascript - any function occuring after that was invlaid, if I moved the funtion up, it would just error out on the next function in line that was still at the bottom of the page.

Like you, mine worked with IE6.

Luckily it works with firefox 2 so at least i have a work around.

Re: Internet Explorer Web Development HTML/Javascript errors with IE7


I had to uninstall IE7 because of another problem. I just went to Control Panel, Add/Remove Programs and selected Internet Explorer 7 from the list. It uninstalled IE7 and reverted back to IE6. Now my computer works as it did before IE7.

Re: Internet Explorer Web Development HTML/Javascript errors with IE7


I have been looking but have not been able to find any info on this max script length issue with IE7. We have the same problem. Is there any documentation that you know of Where did you find this out


Re: Internet Explorer Web Development HTML/Javascript errors with IE7


I also have a situation where a script generates an error in the browser embedded within our app, but not in stand-alone IE7 where it is ok. It works fine in the embedded situation on systems with older versions of IE. We have a situation where a script is trying to close a window that has already been closed by the user. No errors occur except in the case of the embedded browser control on IE7 systems, in which case a "permission denied" exception is being thrown. Surely there must be something I can configure in our C++ code to revert to the usual behaviour. Can anybody help - it would be prohibitively expensive to fix all our code locations to check whether the window has already closed, but I also fear other things might be affected too.

Test page follows:

<title>Script Error</title>

<script language="javascript" type="text/javascript">
var windowsToClose = new Array(); //for holding references to windows that need to be closed

function closeAllWindows()
while (windowsToClose.length > 0)
var WinObj = windowsToClose.pop();
// Permission denied scripting error on following line when invoke in
// embedded web browser on system with IE7
catch (excp)
alert("Caught exception: " + excp.message);
throw excp;
alert("All Windows Closed");

function openWindow()

The core problem with the window closing script in this page is that it relies on
a variable to track how many winows have been opened. When a point in the code calls
on the script to close a window, it does not look to see if the window is still
open, instead it blindly attempts to close the window regardless of whether or not
the window is indeed open.</p>
Under Internet Explorer 6 no error was presented to the user when the code attempted
to close a window that was not present. Under Internet Explorer 7 each time a window
that is not open has a &quot;close&quot; fuction fun on it, there will be a IE script
To Use:</h3>
To simulate the error, do the following with IE7 installed:</p>
<li><a href=openWindow();">Click here to open a pop-up window.</a>
<li>Close it manually.</li>
<li><a href=closeAllWindows();">Click here to once again close all open
<li>You should have had a script error occur when you performed the previous step. If
you didn't see a script error, did you see the dialog saying "All Windows Closed" .
If you didn't see either message, there was a script error, but IE didn't display
a message</li>

Re: Internet Explorer Web Development HTML/Javascript errors with IE7

Kun Cong - MSFT


I think your issue should be the same one I discussed in this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1069592&SiteID=1

If your app uses IHTMLDocument2::write() method to write a document with external script file reference, it is likely falling into this issue. I provided a possible solution there.