Questions tagged [static-resources]

Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, stylesheets, JavaScript, and other files.

Filter by
Sorted by
Tagged with
20
votes
1answer
223 views

Summer '16 appends orgId query string to certain static resources

I have just noticed something very worrying with the represented path to static resource files in Visualforce pages in Summer '16 boxes (sandbox and dev pre-release checked). It seems that for some ...
15
votes
5answers
5k views

Is it possible to use images in Visualforce generated PDFs which are not static resources?

I'm trying to generate a Visualforce PDF (renderAs) with a variety of images from different sources includes Salesforce Attachments and Documents, as well as third party sites. So far I've only been ...
14
votes
2answers
4k views

How do I call functions loaded from a Static Resource JavaScript file?

I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file ...
13
votes
4answers
15k views

accessing static resource in apex

I know that we can access static resources in visualforce page as follows; {!URLFOR($Resource.UploadTemplate)} How can we access the static resource in APEX class? And if it is in a zip file, how ...
13
votes
3answers
2k views

What are the advantages/disadvantages of adding JavaScript libraries as a static resource?

I maintain a product on the AppExchange that currently references both JQuery and custom JavaScript that are included in a static resource. Now that I am making some additional updates to the package, ...
12
votes
2answers
8k views

What does the cache control value control in a static resource?

While creating a static resource there is an option for specifying Cache Control, This contains two values Public and Private. What does these values actually control?. Initially had an Idea that if ...
12
votes
1answer
3k views

Font-Awesome fonts are not loading after Spring'17 release

I am using Font-Awesome in my lightning components and using font-awesome icons in lightning components. It was working fine before 7th Jan 2017, but when today I Logged In into sandbox fonts are not ...
11
votes
3answers
8k views

jquery in a visualforce page

I am new to using jquery in visualforce and seem to be stuck just getting the static resource to work correctly. I have two js files, one is the jquery the other is a qrcode generator. Both are ...
11
votes
1answer
757 views

Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?

Documentation such as Static Resources says: A single static resource can be up to 5 MB in size. An organization can have up to 250 MB of static resources. We have one growing static resource of ...
10
votes
2answers
1k views

Access Custom Setting global variable from Static Resources

"{!$Setup.MyCustomSet__c.URL__c}"; I'm using the above to access custom setting on the page. But when I move the script to static resources and try to access it from there the value is not being ...
10
votes
2answers
3k views

When to use Static Resource vs Documents

I want to use a check mark image in the formula field. I got confused about where to store the image: in static resources or in documents. Please explain to me the use cases of both.
10
votes
1answer
733 views

Salesforce1 referencing a static resource from another static resource

I have a VFpage that runs perfectly on the web. I do a lot of static resource reference from another static resource. What I mean by this is, I have zipped images and javascripts and uploaded as a ...
10
votes
1answer
679 views

How to make script loading in Lightning component really One-Time? [possible bug]

We have a component that is constructed of many smaller components. Few of these components require jQuery and jQuery-ui. In following screenshot you can see that jQuery library is loaded 3 times ...
10
votes
1answer
676 views

Testing callout with zipped static resource

How can I access the content of a static resource zip file to create several callout mocks? I'd like to group all service responses in a single zip file without create several static resources. In ...
9
votes
1answer
1k views

Is it possible to access static resource of a managed package in a local VF page

Is it possible to access a static resource of a managed package in your local environment? Thanks
8
votes
2answers
17k views

how do we access the image files from static resource in css?

I am trying to display images from a static resource in a css property. .PDF { width:50px; height:50px; background-image: url("{!URLFOR($Resource.FileTypes, 'png/pdf.png')}"; } What i ...
8
votes
1answer
965 views

Update StaticResource via APEX ToolingAPI

I'm trying to update StaticResources from APEX. Currently I'm using async methods of apex-mdapi and it works good. On the other side I'm using apex-toolingapi to update ApexClasses which works even ...
8
votes
3answers
1k views

Static Resources being loaded in different order

I am developing a Salesforce application that is using jQuery, jQueryUI and a custom plugin. The script tags in the page markup are in the correct order: <script type="text/javascript" src="/...
8
votes
1answer
301 views

PDF using Static Resource generated from REST doesn't display My Image

I have different ways in my organization to generate my invoice pdf and attach it to my records. My PDF includes a logo stored in a public StaticResource. It works perfectly everywhere except when I ...
7
votes
2answers
769 views

which zip archive format (.rar or .zip) works with static resources without any issues?

I have created a .rar using winrar that contains images and upload as a static resource, but when i tried to access the images they are not displaying on my vf pages. I looked in "View Page Source" ...
7
votes
3answers
3k views

Include custom font in lightning components

I am trying to include a custom font in my lightning components. Unfortunately I am not managing in doing that. I uploaded a .eot file to my static resources and now I am trying to reference to it. ...
7
votes
1answer
917 views

URL rewriting for static resources

I know you can serve static HTML by uploading it as a static resource, but is it possible to create a URL rewrite rule for a static resource? Something like this if (url.startsWith('/coach')){ ...
7
votes
2answers
2k views

Using static resources in OnClick Javascript buttons after “Serve Static Resources from force.com domain” critical update

We're using list view and details OnClick Javascript buttons which reference custom js ans css files stored in static resources and containing some shared logic/styles. The sample code below ...
6
votes
2answers
1k views

Accessing Static Resource Contents from Lightning JS Controller

I am attempting to set the value of a lightning component attribute with the type JSON to the contents of a JSON static resource file. I am using the following to set the attribute from the client ...
6
votes
1answer
1k views

Call Javascript function on visualforce page from static resource?

I have a static resource that contains an angular.js module. Now i want to call, in this static resource, a javascript function that is located in a Visualforce Page. Is it possible to use the ...
6
votes
1answer
1k views

AJAX load JSON from static resource

I am trying to load a JSON file into my VF app via AJAX. It currently sits in a zipped static resource, like such: myResources | |js | |target.json ...
6
votes
1answer
911 views

Spring 17 - Lightning fails to load Static Resources with $Resource in Chrome,Firefox and Edge

After updating from winter 17 to spring 17 I am facing random issues with $Resource variable. This issue is observed: Chrome Firefox Edge and to my surprise everything works smoothly in IE11. ...
6
votes
1answer
55 views

Libraries inclusion propagation to children components in Lightning

If I have a parent lightning component and the component has ltng:require do I need to require the same libraries from the children components or will the inclusion be propagated to children? For ...
6
votes
2answers
331 views

Javascript Button Issue

Full .js button code: {!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT('/resource/' & LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(NOW()),':',''),'-',''),' ',''),10) & '000/JS')...
6
votes
1answer
237 views

Can Person Account records be loaded from a Static Resource as test data without a RecordTypeID column?

Question In an org with Person Accounts enabled, it possible to use Test.loadData() to load test Account records from a .csv file as Person Accounts (not as Business Accounts), but without hardcoding ...
6
votes
2answers
2k views

Dynamic reference to static resource in lightning component

In lightning, we can reference to static resource by a value provider like: <img src="{!$Resource.staticResource}"/> Is there any smart way to make it dynamic like: <aura:attribute name="...
5
votes
4answers
4k views

What is the best way to manage javascript resources for Visualforce pages?

So at the moment when I want to make a quick tweak in a javascript file that enhances a Visualforce page, I have to go: Setup >> Development >> Static Resources Find my script in the list (takes a ...
5
votes
1answer
989 views

What is recommended way to unit test JSON Parser based on JSON.deserializeUntyped calls?

We are doing a lot of JSON data parsing in our solution by own JSON parser implementation. I wonder how can I write unit tests for JSON parser. Is it good approach to load JSON data from static ...
5
votes
1answer
6k views

Accessing Non-Static Variables in Static Methods of a Visualforce Controller

I have a scenario where I have one Vf page called 'myVisualforce' and a custom controller 'myController'. In myController I have some non-static variables for example 'var1' and 'var2' and I have few ...
5
votes
2answers
962 views

Accessing Visualforce static resources from local machine

FINAL UPDATE: just in-case if anybody else is looking the error message solution which I was getting is due to the fact that: When you get a share link, the link points to a web page that displays ...
5
votes
1answer
98 views

Does SFDC serve the entire zip static resource, or just the resources referenced?

When I inspect a page in Chrome/Firefox, I don't see the entire zip file as a requested resource. Only the files referenced are served to the client side. Does SFDC unzip resources server-side before ...
5
votes
2answers
2k views

Is it possible to use Remote Object jsNamespace with an apex:includeScript?

Currently playing with An Example of Using Remote Method Overrides in Remote Objects My VisualForce Page includes the following <apex:remoteObjects jsNamespace="$RemoteContactModel"> <...
5
votes
1answer
8k views

How can I load an image in lightning without including the namespace?

I'm trying to include an image that I loaded as a static resource in a Lightning component. The image doesn't show up if I don't include my namespace. For example, this won't work: <img src="/...
5
votes
2answers
2k views

document.getElementById('id').innerHtml = Static Resource Image

I have written one JS function on click of radio button, I want to show my Static Resource - Image file Help me out here **document.getElementById('id').innerHtml = ****************** My Static ...
5
votes
1answer
551 views

Embed content above Salesforce tabs

I was just checking out this app in the AppExchange, and I want to implement something similar in my own company: https://appexchange.salesforce.com/listingDetail?listingId=a0N30000005ueMvEAI Any ...
5
votes
1answer
357 views

Bad practice to invoke RemoteAction on page load? From Static Resource?

I'm working with a page that is a container for a single page app. <apex:page> <div id="root"></div> <script src="{!URLFOR($Resource.javascriptResource)}"></script&...
5
votes
1answer
3k views

How to reference static resources from a Community HTML header in a cache-compatible way?

Communities allow you to specify an HTML document as a header. However, it's just static HTML – no VisualForce. Therefore, you can't use URLFOR() to generate cache busting URLs to static resources, ...
5
votes
1answer
555 views

Can I get a compile-time reference to a StaticResource in Apex?

In Visualforce Pages, I love how we can do {!$Page.MyPage} or {!$Resource.MyFileZip} and get a hard binding to either, complete with namespace resolution and URL generation. In Apex we can do ...
5
votes
1answer
566 views

BUG Unable to update static resource ( infinite cache at lightning community side, not browser side)

Seems the new SFDC update ( Spring 17 ), it is now impossible to update a static resource. We have a static resource named "res", containing a zip file with following content : /resource ( folder ) ...
5
votes
1answer
339 views

React app no longer loading with <ltng> component

As SF support for third party frameworks in communities was poor we decided to implement it using the component like so <ltng:require scripts="{!$Resource.react_app + '/www/js/main.js'}" ...
4
votes
3answers
1k views

Is there anything wrong with using Static Resource URL without the timestamp?

There is a question about getting the path to Static Resources dynamically in apex and it has some good answers. Here it is for reference. Dynamically get the path to a static resource However, I'...
4
votes
1answer
245 views

Hard-coded resource path vs $Resource global variable?

I've never been able to work out which format is better or if there any differences between these lightning resource access formats: <img src="{!$Resource.your_pic}"/> And <img src="/...
4
votes
2answers
622 views

How can I refer a static resource containing js inside javascript on a visualforce page

I have a zipped static resource uploaded in my salesforce org which contains different types of js . I want them to be referred in my script on visualforce page. How can I do this?
4
votes
1answer
2k views

In a managed package, how should you reference static resource images from css defined in a static resource?

The following works in my dev org and the packaging org, but not in an environment with the package installed: .edit-step-icon { background: url("png_list_edit_icon") no-repeat top left; ...
4
votes
1answer
112 views

How to save a universal value in a Salesforce Instance

I need to save a value in a Salesforce Instance which should be universally accessible (In VisualForce Pages, Apex Classes). An example would be to save the account ID to link all contacts (from the ...