IE8 error "there are multiple root elements" for simple string returning MVC request mapping

0

I have written a simple Spring MVC request mapping controller intended to add an analytics javascript code to my page. The controller returns the script code as simple string which gets added to the page as the source of an IFrame. This works flawlessly on almost all browsers Chrome, Firefox, IE6/7/9 but not on IE8.

Whenever the page hits the request mapping a pop up appears saying cannot start application. On clicking details button on the pop up the following error text is displayed -

PLATFORM VERSION INFO
Windows             : 6.1.7601.65536 (Win32NT)
Common Language Runtime     : 4.0.30319.239
System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll             : 4.0.30319.239 (RTMGDR.030319-2300)
dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : http://myhost/getomniturescript?eventType=addToCart&user=null

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://myhost/getomniturescript?eventType=addToCart&user=null resulted in exception. Following failure messages were detected:
        + Exception reading manifest from http://myhost/getomniturescript?eventType=addToCart&user=null: the manifest may not be valid or the file could not be opened.
        + There are multiple root elements. Line 6, position 2.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [12/7/2011 12:10:33 AM] : Activation of http://myhost/getomniturescript?eventType=addToCart&user=null has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [12/7/2011 12:10:33 AM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from http://myhost/getomniturescript?eventType=addToCart&user=null: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Xml.XmlException
        - There are multiple root elements. Line 6, position 2.
        - Source: System.Xml
        - Stack trace:
            at System.Xml.XmlTextReaderImpl.Throw(Exception e)
            at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
            at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
            at System.Xml.XmlTextReaderImpl.Read()
            at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
            at System.Xml.XmlCharCheckingReader.Read()
            at System.Xml.XsdValidatingReader.Read()
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

Don't know what IE8 sees as duplicate route node (which no other browser seems to bother about) but this is the script that the request mapping method returns -

<script type="text/javascript" src="http://myhost/js/48B5AF20683B121371522205E132D314/omniture/sd_scode.js"></script>
<!-- SiteCatalyst code version: H.23.4.
Copyright 1996-2011 Adobe, Inc. All Rights Reserved
More info available at http://www.omniture.com -->
<script language="JavaScript" type="text/javascript"><!--
/* You may give each page an identifying name, server, and channel on
the next lines. */
s.pageName="addToCart"
s.server=""
s.channel="shoppingCart"
s.pageType=""
/* Conversion Variables */
s.campaign=""
s.state=""
s.zip=""
s.events="scAdd"
s.products="${catalogId}"
s.eVar44="null"
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'!-'+'-')
//--></script><noscript><img src="http://somehost/b/ss/somedev/1/H.23.4--NS/0"
height="1" width="1" border="0" alt="" /></noscript><!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.23.4. -->

I tried returning an empty <script type="text/javascript" ></script> scriplet from the controller method, but I still got a pop up, the error summary had changed to this -

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://myhost/getomniturescript?eventType=showCart&user=null resulted in exception. Following failure messages were detected:
        + Exception reading manifest from http://myhost/getomniturescript?eventType=showCart&user=null: the manifest may not be valid or the file could not be opened.
        + Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed: 
            -HRESULT:   0x8007001f
             Start line:    0
             Start column:  0
             Host file:     
        + A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)

I tried hitting the controller directly from the web browser's address bar and not via the page and the result remains the same. This means that the error has nothing to do with the IFrame or the page that the script is being added to. The script has an empty line at the start which means that the line 6 column 2 position is the start of the second script tag.

Looks like there is some problem with the script which is making it incompatible with IE8. And why in the world is IE8 attempting to open it as an application?

I am really stuck with it, any help will be greatly appreciated.

Regards,

Tushar

java
javascript
xml
spring
internet-explorer-8
asked on Stack Overflow Dec 6, 2011 by Tushar • edited Dec 7, 2011 by Tushar

1 Answer

0

So the problem here is not with script that I am putting on the page. Neither the problem is with the logic. I changed the invocation of the controller to an asynchronous AJAX call via JQuery and it worked.

answered on Stack Overflow Dec 21, 2011 by Tushar

User contributions licensed under CC BY-SA 3.0