How to Dynamically add Javascript to Visualforce Page

by - 1:18 AM

You may encounter a situation where you are supposed to inject a javascript on visualforce page conditionally. Let suppose a case where you detect device of landing page and inject javascript conditionally after finding device  I am sharing a piece of snippet which actually allow you to inject Javascript dynamically. This can also be achieve using jQuery as well

This is fairly simple, the one method I designed here  check if the device is mobile (isMobile()) which in return be used later on as condition to inject the script. If device is mobile then I inject the script




You May Also Like

0 comments