Different ways of referencing web resources – CRM
If you have a HTML file added as a Web resource in CRM and it need to refer below web resources
- new_jquery
- new_dummy
Below are 2 ways to achieve the same
Standard Way
One way is to follow below convention to refer the web resource files in your HTML file
<script src=”../webresources/{webresourcename}”></script>
Referencing by folders
Assume you maintain files in folder structure, in your Visual studio solution which looks as below
- Jscript
- Util
- jquery.js
- helper.js
- Account
- account_form.js
- account_ribbon.js
- Util
- CSS
- dummy.css
Below is a more readable way to refer CRM web resources in HTML file.
Below are steps to achieve same.
Step 1
Add web resources with name as “solution prefix_/{webresourcename}”, as below.
- new_/Jscript/Util/jquery
- new_/CSS/dummy
Step 2
When you follow above naming convention, web resources can be referenced like how we do it in Asp.net projects, as below
<script src=”Jscript/Util/jquery” type=”text/javascript”></script>
Refer MSDN Link