Ошибка IE8 «есть несколько корневых элементов» для простой строки, возвращающей отображение запроса MVC - PullRequest
0 голосов
/ 06 декабря 2011

Я написал простой контроллер сопоставления запросов Spring MVC, предназначенный для добавления кода javascript аналитики на мою страницу. Контроллер возвращает код скрипта в виде простой строки, которая добавляется на страницу в качестве источника IFrame. Это работает безупречно практически во всех браузерах Chrome, Firefox, IE6 / 7/9, но не в IE8.

Всякий раз, когда страница попадает в сопоставление запроса, появляется всплывающее окно с сообщением, что приложение не запускается. При нажатии кнопки «Подробности» во всплывающем окне отображается следующий текст ошибки -

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.

Не знаю, что IE8 видит как дублирующий узел маршрута (что, похоже, не беспокоит ни один другой браузер), но этот сценарий возвращает метод отображения запроса -

<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. -->

Я попытался вернуть пустой <script type="text/javascript" ></script> скриплет из метода контроллера, но я все еще получил всплывающее окно, сводка ошибок изменилась на это -

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)

Я попытался нажать на контроллер прямо из адресной строки веб-браузера, а не через страницу, и результат остался прежним. Это означает, что ошибка не имеет ничего общего с IFrame или страницей, к которой добавляется скрипт. Сценарий имеет пустую строку в начале, что означает, что позиция столбца 2 строки 6 является началом второго тега сценария.

Похоже, есть какая-то проблема со скриптом, который делает его несовместимым с IE8. И почему в мире IE8 пытается открыть его как приложение?

Я действительно застрял с этим, любая помощь будет принята с благодарностью.

С уважением,

Tushar

1 Ответ

0 голосов
/ 21 декабря 2011

Так что проблема здесь не в скрипте, который я выкладываю на странице. Ни одна проблема не с логикой. Я изменил вызов контроллера на асинхронный вызов AJAX через JQuery, и это сработало.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...