vedmack/feedback_me

Check if jquery and other resources has been loaded else load it using script.

Closed this issue · 3 comments

Is it feasible to outsources the work of adding plugin dependencies like jquery and css to some script ?

That script is the only file added into web page. let's call it InitJS

InitJS script would do the following things,
0) InitJS would contain configuration parameters for plugin.

  1. InitJS would Detect if jquery exists on page ? [ Chances are good that it does ]
  2. InitJS would Reuse existing jquery and CSS files or download asynchronously
  3. InitJS would Download the feddback_me js plugin
  4. ..and then the plugin takes over..!

This way our plugin script embedding resorts to minimum file in each page !

What is the motive/advantage ? !
Let us say the InitJS which contains the plugin parameters is dynamically generated from third party server, and those parameters are configured in and generated by some back end !!!

InitJS would always have unique URI which doesn't change, that way the page in which plugin is added remains unaffected as and when the configuration changes, Which would happen in back end and served via same InitJS URI..!!

That way one could roll out FeedbackMe Plugin and it's configuration dynamically without facing end user migration issues as there is nothing to change on web page !

Sounds crazy / useful /feasible / challenging ? :)

This is out of scope for the fm plugin, you are talking about a scenario that is specific to your use case and should not be solved in the fm plugin, in order to achieve your goal you can take a look at the following several solutions to dynamically including libraries (such as jquery) http://stackoverflow.com/questions/10113366/load-jquery-with-javascript-and-use-jquery and http://www.jquery4u.com/javascript/dynamically-load-jquery-library-javascript/ , also, fm doesn't have a cdn hosting place, and you can't use the github as a CDN for hosting the plugin,

Also , I think it would be an overkill to do all this, cause initing the fm is so simple :)

Hope it helps...

Ok, Thanks for the reply.. Am I having the right approach to externalize it though ?

I can't find a reason to try to externalize it, feedback_me is a lightweight plugin and in general js libraries better be served from local server to speed up the loading of the page and also its too much hassle (IMO)