TWilly
TWilly

Reputation: 4943

CRM Dynamics 2015 Include JQuery in Web Resource

I have a standalone web resource inside CRM Dynamics that is being loaded in an iframe.

JQquery is now included as a default library in CRM dynamics so I'm including the following in my web resource to load jquery (this was copied from the main home page of CRM Dynamics).

<script id="/_static/_common/scripts/jquery1.7.2.min.js?ver=-1896091690" src="/_static/_common/scripts/jquery1.7.2.min.js?ver=-1896091690" type="text/javascript"></script>

What I'm wondering is, is there a better way to do this in case the version changes so the cache won't break as soon as the version number changes?

Full html web resource page...

<html>
    <head>
    <meta charset="utf-8"> 
    <link id="/_common/styles/fonts.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_common/styles/fonts.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_common/styles/global.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_common/styles/global.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_common/styles/theme.css.aspx?lcid=1033&amp;theme=outlook15white&amp;ver=-1896091690" href="/_common/styles/theme.css.aspx?lcid=1033&amp;theme=Outlook15White&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_forms/controls/controls.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_forms/controls/controls.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_controls/notifications/notifications.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_controls/notifications/notifications.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_forms/controls/form.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_forms/controls/form.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">
    <link id="/_common/styles/dialogs.css.aspx?lcid=1033&amp;ver=-1896091690" href="/_common/styles/dialogs.css.aspx?lcid=1033&amp;ver=-1896091690" rel="stylesheet" type="text/css">

    <script id="/_static/_common/scripts/jquery1.7.2.min.js?ver=-1896091690" src="/_static/_common/scripts/jquery1.7.2.min.js?ver=-1896091690" type="text/javascript"></script>
    <script id="/_common/global.ashx?ver=-1896091690" src="/_common/global.ashx?ver=-1896091690" type="text/javascript"></script>
    </head>
    <body>
        body content here
    </body>
</html>

I did a little more digging and found a reference to this javascript function that looks like it is used to download jquery and other libraries...

loadScriptAdv('\x2f_static\x2f_common\x2fscripts\x2fjquery1.7.2.min.js\x3fver\x3d-1896091690', '\x2f_static\x2f_common\x2fscripts\x2fjquery1.7.2.min.js\x3fver\x3d-1896091690', false);

Upvotes: 2

Views: 1882

Answers (1)

Guido Preite
Guido Preite

Reputation: 15138

Define a custom namespace for your jQuery library

Tutorial:

jQuery and jQuery UI with Dynamics CRM 2011 & 2013

Upvotes: 2

Related Questions