+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Add the MobileFirst SDK to web applications

Add the MobileFirst web SDK to an existing or new web application to add IBM MobileFirstâ„¢ Foundation capabilities to the application.


Before you begin

Get a copy of the MobileFirst web SDK, and save the ibm-mfp-web-sdk SDK directory, or the containing npm_modules directory (if you downloaded the SDK from npm), to the root directory of your web application. For information about acquiring a copy of the web SDK, see Acquiring the MobileFirst web SDK.

To use the APIs that are exported by the MobileFirst JavaScript web-SDK modules, we must first load the appropriate modules into the web application:

Note: ibmmfpfanalytics.js depends on ibmmfpf.js, and must be loaded first (when used).

The MobileFirst web SDK supports the common standards for loading JavaScript modules:

Use one of the following alternative procedures, which correspond to the described load methods, to load the web-SDK modules:

Note: The examples in the procedure assume that your SDK directory is found in the root of your application directory. If you select to store it in a different location, adjust the script paths in the examples. For example, if you downloaded the SDK with npm and saved the node_modules directory that contains the SDK directory in the root directory of your application, add node_modules/ before each SDK module name.


Procedure


What to do next

Use the initialization method of the core web API to initialize the SDK, and then develop your application by using the web SDK APIs. For more information, see Initializing the MobileFirst SDK.

Parent topic: Develop web applications