I have a requirement to add some javascript/jquery to a page from managed package. Is it possible to do that?
Also, please let me know if I can do DOM manipulation of visual force pages which are from a managed package.
Thanks.
Attribution to: Krishna
Possible Suggestion/Solution #1
I take your question to mean "can you modify a page from a managed package authored by someone else and installed in an org". While you can see the page source, unless the author of the managed package included a mechanism to wire in an alternate page you can't add to the page or change it. (A special case is if the page is not referenced within the package and uses a global controller and global components you could re-create it and change it.)
On DOM manipulation, because that is done in the browser, it can be done for HTML that comes from any source including Visualforce. The hack for Visualforce is to add a home page component with the required JavaScript and typically jQuery that automatically hides itself and does the DOM manipulation. This is loaded by the platform into the browser together with the Visualforce page output (using a domain that includes the managed-package namespace prefix) and so cross-domain problems are avoided.
But a managed package publisher is very unlikely to guarantee to never change the DOM structure or CSS styling or specific id values and your DOM manipulation could break the managed package and will certainly discourage the managed package author from supporting you. So it is only an approach to consider in specific and limited circumstances and bearing in mind the risks.
Attribution to: Keith C
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/31290