cancel
Showing results for 
Search instead for 
Did you mean: 

XMlHttpRequest Error in Fiori application

former_member190063
Participant
0 Kudos

Hi

I have created a sample Fiori Master Detail application. When I try to run the app, it's displaying a blank screen with  a warning message.

Message: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

Index.html:

<!DOCTYPE HTML>

<html>

    <head>

        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        <meta charset="UTF-8">

        <title>${project_name}</title>

        <script id="sap-ui-bootstrap"

                type="text/javascript"

                src="resources/sap-ui-core.js"

                data-sap-ui-theme="sap_bluecrystal"

                data-sap-ui-libs="sap.m"

                data-sap-ui-xx-bindingSyntax="complex"

                data-sap-ui-resourceroots='{"${namespace}": "./"}'>

        </script>

        <script>

        new sap.m.Shell({

  app: new sap.ui.core.ComponentContainer({

  height : "100%",

  name : "${namespace}"

  })

  }).placeAt("content");

        </script>

    </head>

    <body class="sapUiBody" role="application">

        <div id="content"></div>

    </body>

</html>

Component.js:

jQuery.sap.declare("${namespace}.Component");

sap.ui.core.UIComponent.extend("${namespace}.Component", {

    createContent : function() {

        // create root view

        var oView = sap.ui.view({

            id: "idViewRoot",

            viewName: "${namespace}.view.Root",

            type: "XML",

            viewData: { component : this }

        });

        // set data model on root view

        oView.setModel(new sap.ui.model.json.JSONModel("model/mock.json"));

        // set i18n model

        var i18nModel = new sap.ui.model.resource.ResourceModel({

            bundleUrl : "i18n/messageBundle.properties"

        });

        oView.setModel(i18nModel, "i18n");

        // done

        return oView;

    }

});

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member190063
Participant
0 Kudos

Now it is working well after replacing the script src as "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js". Dont know what's wrong with "resources/sap-ui-core.js".

gill367
Active Contributor
0 Kudos

Hi Karthik;

it means the SAPUI5 libraries are getting loaded while creating a new application project in eclipse.

Do you see any "SAPUI5 Core Libraries" folder under JavaScript Resources in your project.

Regards,

Sarbjeet Singh

former_member190063
Participant
0 Kudos

Hi Sarbjeet,

Yeah. It's there in javascript resources.I don't know what's wrong with /resources/sap-ui-core.js.

Instead of that, I am using this src ="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js".

former_member122649
Participant
0 Kudos

Hi Sarbjeet,

If you some time misplaced the folder structure. It will not identify the /resources/sap-ui-core.js. (Usually it must take it automatically).

For your you need to check the folder structure only. Since the complete path with URL is working fine.

gill367
Active Contributor
0 Kudos

Hi Karthik;

This is a warning message usually present in the console log when we make a request to the resources. Are you running your application in the ABAP system or only in the eclipse.

Please share the root view code also. If possible share a screenshot of any error you are getting in the console.

Please go through this document for building step by step a custom fiori application.

Regards,

Sarbjeet Singh

former_member190063
Participant
0 Kudos

I running my code in eclipse and browser.I didn't get any error in the console.

This is my root view code:

<?xml version="1.0" encoding="UTF-8" ?>

<mvc:View

    controllerName="${namespace}.view.Root"

    displayBlock="true"

    xmlns:mvc="sap.ui.core.mvc"

    xmlns="sap.m">

    <SplitApp id="idRoot">

        <masterPages>

            <mvc:XMLView viewName="${namespace}.view.Master" id="idViewMaster" />

        </masterPages>

        <detailPages>

            <mvc:XMLView viewName="${namespace}.view.Empty" id="idViewEmpty" />

            <mvc:XMLView viewName="${namespace}.view.Detail" id="idViewDetail" />

        </detailPages>

    </SplitApp>

</mvc:View>

former_member190063
Participant
0 Kudos
gill367
Active Contributor
0 Kudos

HI karthic;

As you are still in the initial phase of developing this, I will ask you to go through the projects provided at the following link.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60668332-b85d-3110-3fb7-8133d856d3e5

You can share the project structure completely for resolving this issue.

Regards,

Sarbjeet Singh

former_member190063
Participant
0 Kudos

Hi Sarbjeet,

Still I am getting the same error after running the all sample fiori projects which you have given.

Version: Luna Service Release 2 (4.4.2)

SAP UI5 version : 1.30.8

same error as described above :

GET http://localhost:53789/SixthApp/resources/sap-ui-core.js

index.html:21

Uncaught ReferenceError: sap is not defined(anonymous function) @ index.html:21

gill367
Active Contributor
0 Kudos

Hi Karthik;

Does your project structure look like as shown below in the image.

Regards,

Sarbjeet Singh