JavaScript How can I link to a JavaScript file above the site folder in ColdFusion 10? link javascript file to html,link javascript file to another

Here is the problem. The company I work for has a number of sites, and many of them use the same jQuery UI widgets, like datepicker. I would really like to have just one copy of each widget in an _javascript folder on the top level of the server. The problem is that because the code is outside of the site folder, I need to use ColdFusion mappings to point to it. Apparently you can't use these with script or link tags however. It doesn't expand the mapping. So I tried using "ExpandPath" and got a message that it doesn't have permission to access that resource. Some research turned up that JavaScript can't access files on local file systems because that would be a security hole. So, although it was ugly, I tried wrapping the CSS file in tags and the JS file in tags, and then included them with cfinclude. That worked- sort of. The main issue is that apparently the css uses relative links to link to the images used, and those are all broken because the JS is included on a page in another folder from the script and images themselves.

Here is my question. Is there any good solution here? I don't think that what I want to do is unreasonable, but should I give up and just keep a copy of the widgets in every site folder? Thanks in advance for any help.

Answer:1

Included javascript files, like CSS files, don't have to be touched at all by the ColdFusion processor. You just use ColdFusion to craft the link and feed it to the browser like you would any image, attachment, or link to another site. The only difference is that this link is in a <script tag. So if you have several sites and want to access a common /js directory on all of them the work has to be done in the web server itself (IIS/Apache).

In your web server of choice make a virtual directory (or symbolic link) to your javascript directory called /js (or whatever name you choose). Do this for all the sites, and you have one /js directory that is accessible from all the hosted domains.

Answer:2

I am trying to add a span class of "pink" to the end of a string. I can get this to work with one element, But when the page loads more than one, It keeps returning the very first element only. I ...

I am trying to add a span class of "pink" to the end of a string. I can get this to work with one element, But when the page loads more than one, It keeps returning the very first element only. I ...

  1. jquery each target class

I'm trying to filter a list of json data (https://api.myjson.com/bins/5a2aw) using an Angularjs filter. When I just use filter exact matching does not take place and for 1 shows results with id = 1,10,...

I'm trying to filter a list of json data (https://api.myjson.com/bins/5a2aw) using an Angularjs filter. When I just use filter exact matching does not take place and for 1 shows results with id = 1,10,...

I'm new to CSS/Javascript and am having trouble with something that seems like it should be simple. I have a series of radio buttons and corresponding text. I'd like it all to appear as a bullet-...

I'm new to CSS/Javascript and am having trouble with something that seems like it should be simple. I have a series of radio buttons and corresponding text. I'd like it all to appear as a bullet-...

  1. having trouble with netflix
  2. having trouble with hulu
  3. having trouble with facebook
  4. having trouble with instagram
  5. having trouble with memory
  6. having trouble with bowel movement
  7. having trouble with zelle
  8. having trouble with airdrop
  9. having trouble with speech
  10. having trouble with paypal
  11. having trouble with word recall
  12. having trouble with short term memory
  13. having trouble with apple id
  14. having trouble with venmo
  15. having trouble with face id
  16. having trouble with constipation
  17. having trouble with google play services
  18. having trouble with firestick
  19. having trouble with apple pay
  20. having trouble with youtube tv

When coding a MVC 5 view, how do I redirect to a specific action result specifying the controller, action result and a parameter? I am wanting to redirect to this action result in a Dashboard ...

When coding a MVC 5 view, how do I redirect to a specific action result specifying the controller, action result and a parameter? I am wanting to redirect to this action result in a Dashboard ...

  1. redirect action result mvc
  2. redirect to actionresult
  3. redirect action result struts2
  4. struts2 redirect action result example
  5. redirect to actionresult javascript
  6. redirect to another actionresult
  7. actionresult redirect to url
  8. c# redirect to actionresult
  9. actionresult redirect to page