Muokkaa

Jaa


JavaScript web resources

Use JavaScript web resources to create a library of JavaScript functions that can be accessed from anywhere.

Capabilities of JavaScript web resources

With JavaScript web resources, you can more efficiently manage code used in form scripts, webpage (HTML) web resources, or ribbon commands by linking them to shared library of JavaScript functions.

Limitations of JavaScript web resources

Like all web resources, JavaScript web resources use the model-driven apps security context. Only licensed users who have the necessary privileges can access them.

Note

References included in code between web resources aren't tracked as solution dependencies.

Using JavaScript libraries

For information about developing and testing JavaScript libraries as well as how to associate them with ribbon commands and form events, see Client scripting using JavaScript.

Referencing a script web resource from a webpage web resource

All web resources can use relative URLs to reference each other. In the following example, for the webpage web resource new_/content/contentpage.htm to reference the JavaScript web resource new_/scripts/myScript.js, add the following HTML code to the head element of new_/content/contentpage.htm.

<script type="text/jscript" src="../scripts/myScript.js"></script>  

To reference a JavaScript from a different publisher, the path must include the customization prefix for that publisher. For example, for the new_/content/contentpage.htm page to reference the MyIsv_/scripts/customscripts.js page, the src attribute value should be ../../MyIsv_/scripts/customscripts.js.

See also

Client scripting using JavaScript
Web resources
Using Web Page (HTML) web resources
Using Style Sheet (CSS) web resources
Using Data (XML) web resources
Using Image (JPG, PNG, GIF) web resources
Using Stylesheet (XSL) web resources
Streamline web resource development using Fiddler AutoResponder