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)

43
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 ...
25
votes
4answers
3k 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
632 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?
22
votes
1answer
113k 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 ...
21
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 ...
19
votes
6answers
13k 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 ...
18
votes
5answers
438 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 ...
16
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 ...
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
4answers
26k 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
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?
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
1k 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 ...
11
votes
3answers
3k views

Does the Google spider render JavaScript?

Does the Google spider knows how to render JavaScript, or only HTML?
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
274 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
3k 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
1answer
156 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?
10
votes
1answer
361 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 ...
9
votes
5answers
204 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?
9
votes
2answers
161 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 ...
8
votes
9answers
416 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
8answers
4k 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 ...
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
444 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
354 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
5k 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
1answer
481 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
3answers
9k 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
5answers
4k 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 ...
6
votes
2answers
849 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
854 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
205 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
429 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
477 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
84 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
6k 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
420 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
738 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 ...
5
votes
1answer
146 views

Repeated calls with random Javascript append to the URL

I keep getting calls to my server where there is random Javascript appended on the end of lots of the calls, e.g.: /UI/Includes/JavaScript/).length)&&e.error( ...
5
votes
1answer
471 views

When opening a local HTML file, how do I ensure I get the content not a cached version?

I have an issue where the newest content of a local HTML file is sometimes not displayed. Instead, the browser shows a cached version. The workaround is to press <Ctrl>+<F5> but I'd like ...
5
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 ...
5
votes
3answers
7k views

Possible to only load specifiv div of a website?

I have this project i'm working on and id like to add a really small list of nearby places using facebooks places in an iframe feature from touch.facebook.com I can easily just use ...
5
votes
4answers
3k views

Free search tool for static website

I am looking for a free search tool for a website hosting html documentation files. the tool should display the results as listings of page title and few lines of text from that page. It should also ...