2

I'm trying to access some static resource in my visualforce page. I have uploaded a zip file named pqGrid. It's structure is like so:

- pqgrid.min.js
- pggrid.min.css
- images/
    --image1.png
    --image2.png

Following the directions in the sf docs on [referencing a static resource1, I tried the following:

<apex:includeScript value="{!URLFOR($Resource.pqGrid, 'pqgrid.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.pqGrid, 'pqgrid.min.css')}"/>

Onloading the page, I get a 404:

GET https://c.cs10.visual.force.com/resource/7975978979000/pqGrid/pqgrid.min.js 404 (Not Found) GET https://c.cs10.visual.force.com/resource/7975978979000/pqGrid/pqgrid.min.css

I've even tried just referencing an image:

<apex:image url="{!URLFOR($Resource.pqGrid, 'images/cross.png')}"/>

and same 404:

GET https://c.cs10.visual.force.com/resource/7975978979000/pqGrid/images/cross.png 404 (Not Found)

I've made sure that the resource cache control is public

enter image description here

What am I doing incorrectly?

EDIT

Tried putting all the files into another directory, so it is now pqGrid/stash/[*files]

When I get the 404 not found:

GET https://c.cs10.visual.force.com/resource/1430434594000/pqGrid/stash/pqgrid.min.css

I tried playing with this url. Trying to navigate to just /stash/ throws a ERR_INVALID_RESPONSE error. Navigating to just /pqGrid/ let's me download the stuff. Trying to go directly to the file, /pqGrid/stash/file.js I just get a blank page.

So the zip is definitely on salesforce, but something is up with accessing it.

Thanks all!

ZAR
  • 2,550
  • 4
  • 36
  • 66

1 Answers1

1

This happens when we specify incorrect paths for our files would suggest to try below

  <apex:includeScript value="{!URLFOR($Resource.pqGrid, 'pqgrid/pqgrid.min.js')}"/>
 <apex:stylesheet value="{!URLFOR($Resource.pqGrid, 'pqgrid/pqgrid.min.css')}"/>

Sometimes forgetting slash also introduces issues

<apex:includeScript value="{!URLFOR($Resource.pqGrid, '/pqgrid.min.js')}"/>
Mohith Shrivastava
  • 447
  • 10
  • 19
  • I tried that - nothing. I played around with the URL - I've edited my question to explain. – ZAR May 01 '15 at 19:23
  • I did not ask you to put into another directory .The problem for sure is your path is wrong .would be great if you recheck your folder structures and see whats going on .I would load them all separate and call and see if that works – Mohith Shrivastava May 01 '15 at 19:47
  • One answer before yours recommended it - I just haven't changed it back – ZAR May 01 '15 at 19:49
  • Please load all files separately in static resource instead of zip and see if it works ,may be helpful – Mohith Shrivastava May 01 '15 at 19:51
  • Too many files, that wouldn't make sense. According to this doc, it should be possible: https://www.salesforce.com/us/developer/docs/pages/Content/pages_resources_reference.htm – ZAR May 01 '15 at 20:05
  • i understand but just to check your issue . – Mohith Shrivastava May 01 '15 at 20:06
  • Again i am confirming its way you zip these files you are messing something and also way you are referencing files you are messing path.Anyways all the best for your work – Mohith Shrivastava May 01 '15 at 20:43