Why should I use JavaScript Library if it may effect the performance of a web site?
Asked by
Ranimi23 (
1917)
February 12th, 2011
This is an important question and I can not decide when and why should I use JQuery or another JS Library.
Is is very easy to add JQuery to the project and write short commands. It saves me time to write much code in JS that someone already wrote it for me and checked it is working in all browers.
But cellular or mobile programming is not like that. Each additional file directly affects the performance. My testing with JQuery mobile damaged performence badly due to file size, 17KB.
So the question is whether or not it better to spend a little time to write my own JS suitable for what I need and not working with files ready? When is it better and when it is really not?
Be glad to hear your opinions.
Observing members:
0
Composing members:
0
2 Answers
You might want to check out some extremely lightweight Javascript libraries such as xui, zepto, or jQuery Mobile. However, 17KB should not be a huge concern on iOS and Android devices. On phones with minimal web browsing speed and capabilities, you could launch a separate site at m.example.com or mobile.example.com with minimal CSS, small page size, and no Javascript at all.
While iPhone and Android handle richer sites pretty well, ideally you want to have a mobile friendly site that users are redirected to when they visit your site. This can be done with a .htaccess device check and redirect or you can also use @media CSS calls to check device widths and restyle the site for mobile.
If you are really worried about files and file size, i’d make a minimal mobile site, just using CSS, animations/jquery/unneeded files removed in a subdirectory like m.example.com as @Vortico stated.
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.