Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
My site uses a variety of JS scripts. With the ones that I write, I concat to one master JS file.
I have a number of external scripts for things like Pinterist sharing, or Google's places API.
Should these be downloaded and concatenated into my master JS file or should I leave them as a separate call to each of their APIs, as so:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
I think concatination of external scripts is a BAD idea.
What about security fixes and updates? You would loose all of that. Many resources like Google etc get updated regularly, so you would have to check it, download it and concatinate. That is too much work for 'having one master JS file'.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I've been looking at ways to improve perfomance of my website. I've seen many people mentioning that it is good to minify files in production, which would improve speed as the amount of data that needs to be transferred would reduce. To my understanding, most modern browsers cache HTML, CSS and JS files. If that is the case, is there any additional benefit of minifying these files?
"To my understanding, most modern browsers cache HTML, CSS and JS files"
True, but cached resources are available only after the first visit. The first visit to your website will result in the client downloading all of these resources, and only then caching them, which could result in high response times for large files.
Resource file minification has no other real benifit besides reducing loading time.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
So I recently stumbled upon jscrambler.com
This tool actually allows you to protect your javascript code, its fascinating. However, the service is cloud based and im wondering if this is really ok. Since im actually posting code on their servers. While others cant steal my code, it is still vurnerable to theft from within the the guys behind jscrambler.
Maybe im worrying too much. Is it safe to use jscrambler services?
You're right. Giving your code to a 3rd party to protect it is as counter-productive as it is counter-intuitive.
That said, browser users always have access to the underlying Javascript code. The most you can do is wrangle the source code by making syntactic changes that produce the same functionality but result in harder-to-read text.
This process is known as uglification or minification (since it reduces file size). UglifyJS is the most frequently used tool for this.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm making a website for a client that will mostly be used offline through a wifi router. But there will also be an online version available. The purpose of this is to distribute files in parts of the world where infrastructure is not suitable for internet access. For those who do have internet access in some of these parts, the internet probably isn't very fast or reliable.
Some of the pages I've made can be accessed simply by using JS functions to hide one page and show another, instead of anchoring to another file. I figured this method might load content quicker, rather than linking to multiple pages. But is that true? Or should I just put all the content on separate pages?
Yes, that's true, but most browsers doesn't load a page if they don't get an answer, so you'll need at least one local server. You can store almost everything (style, script and content) in localstorage, store as strings and eval if/when needed. Also, if local processing isn't a problem you can use AngularJS to build and rebuild the page.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What are the pros and cons of different methods of including data from a database on your webpage?
From my understanding I have two options. A html page, with JavaScript (or other browser language) that fetches and includes data. A php script (or other server based program) that builds and outputs an html page with the data already included. But how am I to made the decision between the two?
Always go for PHP when using a database. It is a more robust and proven technique.
Also PHP pages are protected by the server and nobody can see how the code works, they only see HTML output, whereas with Javascript anyone can see your code.
After all I don't know how JS supposed to interact with data, maybe store data in an XML page and then retrieve them, not sure. Why invent a wheel when you have PHP which is supposed to work with databases unlike JS which is designed mostly to be an improved front end functionality, unless its back end JS, but few people use JS that way.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Most programming/markup languages that I know have commands called include, import, load, require, input, etc. that call subfiles from the main file, but as far as I know, JavaScript does not have such feature, and a suggestion that I often see for such case is to insert a <script> tag into the dom (programmatically from the main file), which I think is very indirect. Why does JavaScript lack such feature? Was there any design decision?
who said no? Read about this tool: Helios Kernel
But will it be is conveniently for you?
If you use it with node.js for instance, it does have require().
Unlike most languages, JavaScript is generally client-side. If you want to do this from the client, how would you do that if the file you want to include is actually located on the server? JavaScript does have eval() and many other useful functions to do this, but you need to understand that you are dealing with requests through http and not files on a file system.