<p>Think you need:</p>

<pre><code>UrlHelper::getResourceUrl('path/to/file.ext')
</code></pre>

<p>There is more info over at <a href="http://buildwithcraft.com/docs/plugins/resources" rel="nofollow">http://buildwithcraft.com/docs/plugins/resources</a></p>

<h2>Edit</h2>

<p>ok, scrap that answer, I didn't read the rest of the help page :) </p>

<p>I think you are nearly there though. I'll have a test on my local machine and get back to you.</p>

<h2>Edit 2</h2>

<p>I believe I'm running into the same problem you have described as well. I did however get it working by doing this:</p>

<pre><code>&lt;script src="{{ resourceUrl('eforms/js/public.js') }}"&gt;&lt;/script&gt;
</code></pre>

CC BY-SA 3.0
2014-07-29T09:55:50.337Z
I appreciate the effort but unfortunately this file needs to appear after a number of others so I must use the includeJsResource method.
michael
CC BY-SA 3.0
2014-07-28T10:11:35.283Z
2014-07-28T10:46:29.993Z
2014-07-28T10:46:29.993Z
Dave Coggins
<p>I've created a simple plugin based on the Craft docs with the following directory structure...</p>

<pre><code>/craft
    /plugins
        /eforms
            /resources
                /js
                    public.js
            /templates
                /public
                    index.html
/public_html
</code></pre>

<p>In the index.html template of my plugin I'm using the following line to try to include the public.js file...</p>

<pre><code>{% includeJsResource "eforms/js/public.js" %}
</code></pre>

<p>Which attempts to include the following resource in the browser</p>

<pre><code>http://mydomain/eforms/js/public.js
</code></pre>

<p>Unfortunately this just gives me a 404. Does anyone have an idea of what I'm doing wrong?</p>

<plugin-development><javascript>
Including plugin javascript on the client side
# Including plugin javascript on the client side

(Asked by: username_0 on 2014-07-28)

I've created a simple plugin based on the Craft docs with the following directory structure...
/craft
    /plugins
        /eforms
            /resources
                /js
                    public.js
            /templates
                /public
                    index.html
/public_html

In the index.html template of my plugin I'm using the following line to try to include the public.js file...
{% includeJsResource "eforms/js/public.js" %}

Which attempts to include the following resource in the browser
http://mydomain/eforms/js/public.js

Unfortunately this just gives me a 404. Does anyone have an idea of what I'm doing wrong?

**Tags:** plugin-development, javascript

---

## 1 answers

### Answer by username_1 on 2014-07-28. Score: 4

Think you need:
UrlHelper::getResourceUrl('path/to/file.ext')

There is more info over at http://buildwithcraft.com/docs/plugins/resources
Edit
ok, scrap that answer, I didn't read the rest of the help page :) 
I think you are nearly there though. I'll have a test on my local machine and get back to you.
Edit 2
I believe I'm running into the same problem you have described as well. I did however get it working by doing this:

> **Comments:**
> **username_0**: I appreciate the effort but unfortunately this file needs to appear after a number of others so I must use the includeJsResource method.  

---

