JavaScript is a dialect of the standardized ECMAScript programming language, primarily used for scripting web-pages. Use this tag for questions regarding ECMAScript and its dialects/ implementations: JavaScript, JScript, etc., excluding ActionScript.

learn more… | top users | synonyms (2)

44
votes
16answers
2k views

HTML validation: is it worth it?

What are the advantages and disadvantages (if any) of making sure that all pages validate compared to having non-valid HTML that however works on all major browsers? Also, is having valid HTML after ...
30
votes
1answer
139k views

How to open the JavaScript console in different browsers?

Updated on October 7th 2012 Chrome: Press either CTRL + SHIFT + J to open the "Console" tab of the Developer Tools. Alternative method: Press either CTRL + SHIFT + I or F12 to open the ...
25
votes
4answers
4k views

Does “putting Javascript at the bottom” defeat the purpose of document.ready?

I know that it is recommended to put Javascript at the bottom of the page, but if I'm using jQuery doesn't this defeat its purpose to run as the DOM is loading? If I have a dropdown menu, for ...
23
votes
5answers
728 views

How can I reduce the costs of loading large JS libraries?

If I am using a large Javascript library for my page, how can I make sure that this does not impair the user's use of the site?
23
votes
6answers
16k views

How do you exclude yourself from Google Analytics on your website using cookies?

I'm trying to set up an exclusion filter with a browser cookie, so that my own visits to my don't show up in my Google Analytics. I tried 3 different methods and none of them have worked so far. I ...
22
votes
4answers
2k views

Why insert static files (CSS, images, JavaScript, ECC) in a subdomain?

Why so many big and little sites inserts static files (CSS, images, JavaScript, ECC) in a subdomain like media.example.com or s2.static.example.com? What are the advantages? Why not just a directory ...
21
votes
1answer
1k views

Someone else is using our Google Analytics Tracking code number. What do we do?

After looking over our Analytics today, I realized that another website is also using our same tracking code #, which is cause quite a few incorrect hits to our Analytics. Are there any ways to ...
18
votes
5answers
461 views

What documentation exists for HTML, CSS, and JavaScript?

PHP users have the PHP.net docs Ruby users have Ruby-Doc.org Python users have docs.python.org jQuery users have docs.jquery.com All are considered go-to references when working within those ...
17
votes
6answers
3k views

Can we ignore visitors without JavaScript enabled?

If you have developed a JavaScript based website, is it worth doing the extra work to make it accessible for visitors who don't have JavaScript enabled? What percentage of visitors are in this ...
15
votes
4answers
33k views

How do I set expiration headers for CSS, JS, and Images?

I have recently analysed my website with pagespeed addon on firebug. It suggested me to set expiration on CSS, JS and image files. I am wondering how do i do this?
14
votes
5answers
2k views

What's the best way to load Javascript into a page to optimize performance?

Is there a way to load my JavaScript into a page that will make it load faster?
14
votes
7answers
2k views

What should I use to automatically combine css/js files?

I'm aware of sprockets for combining javascript files, but haven't tried it. What are some other options and how do they stack up?
13
votes
4answers
3k views

Does the Google spider render JavaScript?

Does the Google spider knows how to render JavaScript, or only HTML?
12
votes
8answers
3k views

Is inline JavaScript good or bad?

I've currently switched from WordPress to Yii framework and an external developer is rebuilding my site. One thing I notice is that each time he invokes AJAX / jQuery the Yii way, it embeds inserts ...
12
votes
5answers
3k views

Should I worry about people disabling Javascript?

Often when picking new tools and frameworks I see the warning "Will not work if the user has disabled Javascript". I then look at my Javascript powered slideshow, Javascript powered menu, and ...
12
votes
4answers
2k views

Loading main javascript on every page? Or breaking it up to relevant pages?

I have a 700kb decompressed JS file which is loaded on every page. Before I had 12 javascript files on each page but to reduce http requests I compressed them all into 1 file. This file is ~130kb ...
12
votes
1answer
4k views

Is this a good approach to image Lazy Loading for SEO?

For images loaded via AJAX, or that I don't want indexed, use the data-* attribute approach: <img data-src="path/to/image.jpg" class="js-lazy-load" /> The javascript maps the data-src ...
11
votes
5answers
9k views

Chrome refused to execute this JavaScript file

In the head of my HTML page, I have: <script src="https://raw.github.com/cloudhead/less.js/master/dist/less-1.3.3.js"></script> When I load the page in my browser (Google Chrome v ...
11
votes
4answers
2k views

Should I combine js/css files into a single file?

Both YSlow and Google's Page Speed add-ons recommend combining script (and style) files into a single file each to reduce the number of HTTP requests, and I can certainly see the point of this when ...
11
votes
5answers
278 views

Should JavaScript referenced in the head section be served from the same hostname as the main document?

I was under the impression that for the best performance, Javascript should be treated as static content and served from a cookieless domain along with CSS files, images, etc. But Google says here: ...
11
votes
1answer
163 views

What is the benefit of using Google Analytics' asynchronous tracking code compared to the non-asynchronous code?

What, specifically, does the asynchronous code accomplish or allow that the older code does not?
11
votes
1answer
396 views

When and when not to use a CDN

I'm working on a web-application that loads a couple of small gif images onto the screen. I'm using a relative path, which means they are loaded from the same web server that serves the php page. The ...
11
votes
2answers
914 views

Lazy loading images and effects on SEO

We are using the following technique to lazy load images in our site: For all images we put in the src attribute a url for a default img (i.e. a loader) and put the actual image url in the data-src ...
10
votes
5answers
208 views

What new cross-browser features can we use if we drop support for IE6?

My company is dropping support of IE6 and I just realize that we can use a set of great features. Is there a list of CSS, Javascript features which we can use with IE6 RIP?
10
votes
2answers
189 views

Automated Website Testing/Sanity/Quality

I am thinking about building a tool that starts from the root of a webpage and traverses the entire website gathering a list of resources such as CSS/HTML/Javascript files and then runs CSS/Javascript ...
10
votes
2answers
413 views

Google indexing pages with #! although we don't have any

Our company has developed a Single Page Application using AngularJS and its routing. Google indexed our site decently with JavaScript but it did not index some pages very well so we have developed an ...
8
votes
9answers
432 views

How do I compress my JavaScript and/or CSS?

I know that there are ways to dynamically load it into the page, but if I want to compress my code so it loads even faster, how do I do it?
8
votes
2answers
816 views

Anyone still using JavaScript disabled? [duplicate]

Is there anyone left that's not using JavaScript? When designing websites, is it worth to care about that fraction of visitors? At least in Firefox you can't even disable it anymore.
8
votes
8answers
5k views

Why not AJAX'ify entire websites?

Is there any solid reasoning as to why sites shouldn't be developed with ajax functionality that loads major parts of each part (assuming there are elements like the header, navigation etc that remain ...
8
votes
7answers
1k views

Can anyone list some real examples of 'HTML5' being used in the wild?

I am using HTML5 in the same way everyone seems to be using it these days, meaning: HTML5 tags, Canvas / 3D / javascript and CSS3. I am struggling to find examples of sites that are using these ...
8
votes
3answers
2k views

Directory structure for a website (js/css/img folders)

For years I've been using the following directory structure for my websites: <root> ->js ->jquery.js ->tooltip.js ->someplugin.js ->css ->styles.css ...
8
votes
1answer
569 views

Does adding external images or javascript to a website affect its SEO?

When adding images to your site, is it bad to use an image located on another site: <img src='http://www.some_other_site.com/image.jpg'> The same goes for javascript, is it bad to link to ...
7
votes
9answers
1k views

prototype.js or jQuery for new projects?

Should I use prototype.js or jQuery for a new project? Rails comes with prototype.js but jQuery seems the library of choice for the rest of the world. Is prototype.js still under active development? ...
7
votes
6answers
449 views

Font resizing widgets: worth it?

I see some text-heavy sites implement the little JavaScript widgets that allow you to choose smaller or larger text sizes on sites. (e.g.: as described on the Guardian's website) Are these little ...
7
votes
4answers
362 views

Who Is Against CSS and JS?

I know there is a group which promotes very basic HTML. They advocate against CSS and JavaScript. Does anyone know the name of this group? Just to be clear this was a website, or a foundation, or a ...
7
votes
3answers
4k views

Would redirecting to a new home page affect SEO?

I'm currently working on a new landing page for this site. I want the landing page to replace the existing front page of the site. However I don't want to lose the Page Rank of the current front page ...
7
votes
3answers
7k views

Upload image file: is compression on client side already possible?

When offering photo file uploading, usually the user will have badly compressed and huge (10+ megapixels) JPEG files from their cameras or phones. On the server side, these files will get ...
7
votes
2answers
2k views

What are the differences between Firefox's Javascript engine and Chrome's V8?

I've noticed that Chrome and Firefox take different amounts of time to render certain things. In general, Chrome has been faster. What should I know about both of them (and IE8/9, too, I guess) when ...
7
votes
3answers
10k views

Why would you use document.location.protocol instead of plain // prefixed urls?

For instance Google Analytics uses document.location.protocol in the boilerplate for tracking: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', ...
6
votes
4answers
1k views

Something like firebug for internet explorer?

Is there something like Firebug for Internet Explorer? I've got a site that is only supposed to be working in IE so I'm only targeting IE and the site is not supposed to work in Firefox.
6
votes
2answers
1k views

JavaScript based Audio player.

I am trying to find an Audio-Player, javascript based. I have tried a bunch of them, but was unable to find one with "Analytic", "Caption", "Control-Bar" etc other features. Can I have some ...
6
votes
2answers
923 views

Text limit on analytics event code

I am just about to add the event code a button that downloads the PDF. Event code fields: _trackEvent(category, action, opt_label, opt_value, opt_noninteraction) Example of event code: ...
6
votes
3answers
920 views

Multiple google analytics instances on a page?

My company creates (and hosts) sites for many different clients. We allow clients to send us tracking code, including Google Analytics, and we put them on the page. We would also like to include our ...
6
votes
1answer
212 views

If all content is on a single page and hidden/shown with JS would it make sense to use hashbangs?

I have a page where the general structure is <a href="#section1">section 1</a> <a href="#section2">section 2</a> <a href="#section3">section 3</a> <a ...
6
votes
2answers
487 views

Monitoring GWT website

We currently monitor our webapps using cURL. More and more of our webapps use the GWT framework, which uses tons of JavaScript, and we can't rely on our cURL system to monitor anymore. Therefore, we ...
5
votes
2answers
540 views

Which is better, minified or obfuscated code?

I’m confused between the two. Which is better, especially for jQuery and JS? Also, which do you think is more SEO-friendly? Note: I’m a noob.
5
votes
2answers
94 views

SEO & Return false on click event

I have a dropdown menu and I'm a trying to make it function more logically on touch devices, it currently following the link. On desktops the dropdown menu is displayed onmousehover and when the menu ...
5
votes
3answers
7k views

What is the optimal folder structure for a web directory?

I've been doing web development for years, and I've always done a web structure similar to this: public_html/login.php public_html/css/login.css public_html/js/login.js public_html/img/logo.png ...
5
votes
4answers
485 views

Will JavaScript (document.write) content be indexed by search engines?

I have an external JS file embedding some content inline in a web page. Basically it just does a document.write("my content") via a script tag and loaded externally with the src attribute. Any ...
5
votes
1answer
863 views

How to SEO Optimize JavaScript Image Loader?

I am building an image-centric catalog website. It catalogs collectible gaming cards numbering 100,000+ pages. There are competitor sites receiving millions of hits each month, so with the possibility ...