Why File Naming is More Important Than You Think

Tweet

File namingNaming your web files is not normally considered to be particularly important. Developers rarely spend much time deliberating file and folder names unless they are implementing a REST API or adding keywords that an SEO expert insists will help their marketing effort.

However, the folder and file names you choose for your HTML, CSS, JavaScript, and graphic files can have a catastrophic effect. As an example, this is how the eBay UK home page looks on my browser today:

eBay UK

The reason: I use Adblock Plus, a Firefox add-on that removes adverts from the page. Adblock Plus is the most popular Firefox extension and it has been downloaded 50 million times. Adblock is not alone: there are dozens of freeware, shareware, and commercial advert blockers for all the mainstream browsers. Even unsupported browsers can use web-filtering proxy servers such as Proxomitron.

As a developer, there is absolutely nothing you can do to stop advert blocking software. The majority of blockers use regular expression rules to check domain names, file names, or HTML code. The reason eBay looks so bad is because several of the core CSS files are being blocked; they do not contain adverts, but their filenames inadvertently trigger Adblock’s rules.

Although you can not stop advert blockers, you can avoid using advert-like names within your legitimate files and folders to ensure they are not trapped. Typical names to avoid include:

  • any word featuring the text ‘ad’ or ‘advert’. I would even be wary of words such as ‘add’, ‘adjust’ or ‘admin’.
  • combinations of words featuring ‘banner’, ‘click’, ‘server’, ‘bureua’ or ‘syndicate’.
  • inclusion of numbers with standard banner sizes, e.g. my-image-468×60.jpg

Above all, test your system using a variety of advert blocking software.

Have you been caught out by advert blockers? Do you have any other suggestions to ensure files are not accidentally blocked?

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • agentolivia

    Hm. Hadn’t thought adding an ad-blocker test to the site launch checklist. Not a bad idea at all. Thanks for the tip.

  • jufemaiz

    The problem is that anything you do, the advertisers are just as capable of doing. Part of the fun of the game I guess.

  • horrible article

    I guess I expected more out of this article…I was anxious to read it but overly disappointed.
    could’ve talked more about conventional uses for file names such as camelCasing.png, and other types..the reason why some work vs. others. why to stay away from certain characters, os cross-compatibilities, talk about namving conventions as a whole and possibly consider talking about subversioning tools and best practices, etc. overall, I didn’t feel the one-two punch you were trying to deliver. this was definitely something I wanted to send to my co-workers; but I don’t think they’d get anything from it.

    ps-just because it was downloaded 50million+ times…doesn’t mean everyone uses the ad-block plugin.

  • Gunnar

    This is one of those ambivalent things. As a developer I think many ad block filters are way to general, and may often ruin completely legitimate sites. There are instances where the most semantic names for a situation can trigger the filters, and I’m inclined to believe that users of such filters should be aware of the fact that they may get an impaired experience.

    (Not to mention the fact that I find it deeply amoral to be willing to consume the content (often for free) on a website whose income relies on money from advertisers, while blocking the ads. If you don’t think the site is worthy of existing, why visit it?)

  • Cabbage

    I’d tack “sponsors” onto that words-to-avoid list. Already been bitten by this once. D:

  • http://www.optimalworks.net/ Craig Buckler

    There are some advertisers that do not use these words, but they’re easily blocked too. Many ad-blockers use a huge list of domains so it’s difficult for advertisers to beat that.

    Unlike spammers, I don’t think advertisers try too hard to get around ad-blockers. Why would they? If I want to block adverts, I’m hardly going to click one that creeps through the net.

  • http://programmersnotes.info KJedi

    I think, it’s the problem of user of the plugin. If he hates advertisement so much that installs the plugin, the only thing you should do about this – include some detection into the code and notify user, that he may see the page incorrectly because he’s using that plugins.
    I am using internet all my day long and I don’t install plugins to block the ads, I just don’t pay attention to them.
    It’s nearly the same as taking care of IE5 users on the JS-powered website. Upgrade browser, it’s free or go away!

  • victor

    It is ironical that you advocate the use of ad blockers on a site that puts banners. If everyone did as you do no revenue would be generated

  • http://www.optimalworks.net/ Craig Buckler

    @KJedi
    Technically, it’s a little tricky to detect the existence of a plug-in, especially when it may not be a plug-in causing the missing file anyway. You could write some JavaScript to check that certain files had loaded, but that script could be blocked itself!

    Overall, it’s probably easier just to be a careful with filenames and test your code in the most popular advert blockers.

  • http://www.cemerson.co.uk Stormrider

    You can never be certain what a particular user has or hasn’t blocked though, and you could always argue that if they decide to use ad blocking software (I use adblock plus as well), then the results they see are their own doing. It wouldn’t stop me using a filename like admin.css or whatever.

  • http://programmersnotes.info KJedi

    @Craig Buckler
    Well, you can put <h1 class=”nocss”>Switch off your advert blocker and refresh the page<h1>
    And hide it with CSS or JS, that is more likely to be missed. So user will see this is something is blocked.

  • tehgamecat

    If there are ads and it’s your revenue stream and the sole purpose for creating the content why not hide all content from those people that use the adblockers?

  • Edenya

    Overall, it’s probably easier just to be a careful with filenames and test your code in the most popular advert blockers.

    Easier to change 12 000 000 developers habits than not using a wide rule as .*ad.* ? not sure about that …

    I thinks that should be the plugin’s developpers problem not to have false positives…

  • tiggsy

    This is a bug in adblocker. You’re a user of this plugin, why not notify them about the unintended consequences of their poor work, so they can do something about it?

  • Tarh

    Well, you can put … And hide it with CSS or JS

     
    And then all I have to do is write a Greasemonkey script to remove your <h1> and distribute it. Or, if I’m the developer of AdBlock Plus, I can just add that right into the plugin.
     
    You can’t stop ad-blockers. Stop trying.
     

    Not to mention the fact that I find it deeply amoral …

     
    This is the exact same debate that has been raging with software piracy for ages. The standard response is this:
     
    You’re not losing any revenue because someone who is blocking ads wouldn’t buy from your ads anyway.
     
    As far as getting revenue for displaying ads (regardless of whether or not they are clicked), you need to find a new business model.

  • http://www.optimalworks.net/ Craig Buckler

    @victor

    It is ironical that you advocate the use of ad blockers on a site that puts banners. If everyone did as you do no revenue would be generated

    I did not advocate blockers, only mentioned that I and many other people use them. Adverts and blockers have been around a long time. If you never click on ads, then it makes no difference whether you block them or not.

  • http://www.mikehealy.com.au cranial-bore

    I’d never have thought of this. It does seem a bit like carpeting the world to avoid having to wear slippers, but I understand that you can’t control weather or not your visitors are wearing slippers.
    It does seem like a pretty dumb thing for ad blockers to rely on though. If this became widely known enough that developers named their files appropriately how long before advertisers catch up? 20 minutes or 30?

  • http://www.papayasoft.com/ rundmw

    Yep, got burned by this recently.

    Could not for the life of me figure out why image X wouldn’t display in Firefox. Firebug showed the image in the HTML source and in the DOM, but styled with img:-moz-suppressed from a stylesheet with the url resource://gre/res.html.css.

    Eventually figured out that AdBlock was the cause.

    Once again, that darn machine doing what it was told rather than what I wanted. Man, those telepathic interfaces just can’t arrive too soon for me.

  • http://www.optimalworks.net/ Craig Buckler

    @cranial-bore

    It does seem like a pretty dumb thing for ad blockers to rely on though. If this became widely known enough that developers named their files appropriately how long before advertisers catch up? 20 minutes or 30?

    It’s not as simple as that. Most advertising agencies use standard code that they issue to thousands, if not millions, of website owners. Take Google Adwords – it can be blocked by checking for the word ‘googlesyndication’ in the URL.

    There’s nothing to stop a advertiser updating their advert code, but every website using their existing system would break. It’s not worth the hassle, especially when tools such as Adblock can update themselves and the regex rules instantly.

    Developers should always remember that the user can override anything. It’s easy to block images, CSS, JavaScript, cookies, frames, or specific URLs. You’ll never overcome that no matter how hard you try.

  • agentolivia

    I think the point of this post is simply to make developers aware of a popular plug-in that may negatively impact the display of a web page, even one that does not display ads. Prevalent wisdom tells us to test the display of our website’s content with CSS turned off, with screen readers or emulators, with images turned off, with colors simulated for person’s with specific types of color blindness, etc. We want to make sure that meaningful content can be extrapolated by all potential visitors, if possible, even if the page isn’t displayed pixel-perfect. To me, testing with this plug-in turned on is another (possibly important) way to test for accessibility of content.

  • tonychung

    A client once told me that we shouldn’t have to pander to bad algorithms some programs use to filter content. One would think adblock would remove content that uses excessive cross-site javascript, iframes, or other more prevalent ad techniques, and not rely on just filenames.

    If any combination of “ad” is automatically blocked, then content using the words “head”, “leader”, and “onload” would also be filtered. That’s just plain stupid.

  • MonztA

    If a legit file is blocked accidentally by a not “ad-like” filter, then you should report it to the filter list maintainer.

  • http://www.j9consultants.com jef2904

    This is a great post this something that has never even crossed my mind. This seems like it doesn’t happen a lot but it might have caused some people many headaches.

  • http://fcOnTheWeb.com ferrari_chris

    I can see the logic here. The user downloads an application or plug-in that stops them from viewing parts of the Internet or parts of a website. Then, unbelievably, the website doesn’t render correctly!

    Users of this software should be prepared for an inferior viewing experience.

    There are calls to stop developing for IE6 and let the users suffer a poor experience as a consequence of running it. To me, this is the same. If you’re going to run software that alters the appearance of a website, live with the consequences.

  • Newton

    this is the worst idea ever…you’re basically telling me to strip out my semantic class names because somebody wants to block ads. I say let them block the ads, but that will come with serious consequences for the users. Who wants their users to block the ads that pay for the site to go up. Users are retarded…everyone wants something for free and so for the company or service provider to afford that, they serve up ads on their site. So if these users block ads, then they’ll get charged for the services, which in turn they’ll complain about. I mean imagine if Google, Yahoo and all of the search engines stopped serving ads on their results and started charging you to search the web.

  • http://www.qiboo.com artemis

    The title for this post is misleading it would have been better to cal it ways to avoid ad blocking or something else.

    Anyway, I found a while back that all the categories of one of our shops were being blocked because the categories all used a 150 X 150 square image. To fix the problem all I had to do was strech the height by 1 pixel. Absolutely crazy. I think inline ad blockig software should be illegal, it is no different than piracy.

  • http://www.studio-gecko.com/ XLCowBoy

    AdBlock software aren’t perfect at all. Sometimes they block out legitimate Javscript, sometimes they don’t. Sometimes they block out Flash, sometimes they don’t. More often than not, users use adblock to prevent unknown stuff from happening when they enter a new site. Once they “trust” the site, they unblock it.

  • http://www.optimalworks.net/ Craig Buckler

    @Newton

    this is the worst idea ever … you’re basically telling me to strip out my semantic class names because somebody wants to block ads

    No, that’s not the case. Only your public-facing URLs could be a problem. You can still have a PHP class/file called “big-advert-banner.php” and include/require it without problems. Similarly, you can call JavaScript objects any name you like – it’ll only be blocked if the filename matches a regex.

    everyone wants something for free and so for the company or service provider to afford that, they serve up ads on their site

    You cannot stop your site or parts of it being blocked, but the vast majority of people do not use advert blockers. Those who do, aren’t likely to click adverts anyway. In fact, I personally would not visit certain sites if I couldn’t block their highly-intrusive banners.

    All forms of advertising are flawed. Using your own argument, should people be forced to watch TV adverts rather than fast-forwarding or making a drink? Few websites depend on advertising as their sole income. If a website fails because of ad blockers, their business model was never sustainable in the first place.

  • http://www.qiboo.com artemis

    Using your own argument, should people be forced to watch TV adverts rather than fast-forwarding or making a drink?

    Most people can’t fastforward adverts unless they have a PVR and while ad breaks can be great for making drinks, I am sure most people sit through quite a few of the breaks.

    Media companies are fighting against torrent distributors for the reason that they are losing advertising revenue due the adverts usually being stripped out of illegal files. Why should web content be any different.

    I am surprised that there aren’t scripts to block the ad blockers. Take the premium content, put it in a container that would be blocked by an ad blocker and then detect this with javascript which then displays a message regarding the ad blocking. I know easier said than one.

  • http://www.optimalworks.net/ Craig Buckler

    @artemis

    I am sure most people sit through quite a few of the breaks

    …and I’m sure most people do not use ad blockers.

    Also, unlike TV, many people have to pay bandwidth charges to download your adverts!

    I am surprised that there aren’t scripts to block the ad blockers.

    Because it’s technically impossible. My browser requests a file from your server. If I choose not to request that file, you can’t force me to have it!

    You can get around ad blockers by hard-coding adverts into your HTML (like DevHub). Or, you could simply call your premium content files “advert.html” so those with ad blockers won’t see it.

    So, well done – you’ve blocked a proportion of users who will never return again. They can’t link to your site or promote your excellent pages to other people (who might have clicked your adverts).

    Who has really lost out?…

  • http://www.pricebonus.com/ PB

    If a legit file is blocked accidentally by a not “ad-like” filter, then you should report it to the filter list maintainer.

  • tehgamecat

    Craig, they buy a tv, they buy cable, they buy etc etc that argument is irrelevant.

    AND

    If you lose the readership of people who do not view your ads AND your model is content + advertising then who cares. I dont believe Pay Per View companies care if poeple don’t get to see their content for free as your suggestion would imply.

    Bottom line – if you block ads and you dont get an ideal presentation too bad.

  • http://www.optimalworks.net/ Craig Buckler

    @tehgamecat
    The TV argument is not irrelevant. Few people pay per minute to watch TV, so you’re not charged to watch ads (longer shows = more electricity, but that’s about it). However, many users pay per MB for their bandwidth (especially on mobile devices), so they are paying to download adverts. Cutting ads will probably cut their bill by what – 50% if not more?

    People using ad blockers accept that they won’t get the same page. The purpose of this article was to point out that legitimate files can be blocked if you’re not careful with naming. There’s no point blaming blockers or developers – it’s happening and you can avoid it.

    Finally, you can block people from viewing your premium content if they use an ad blocker. But since those people won’t click ads anyway, you’re not exactly losing out. Also, would you block a screen reader user because they do not load advert images?

    Ultimately, it’s self defeating: fewer people can use your site, so fewer people can link to or recommend it.

  • tehgamecat

    The service is to pay to watch a tv show without ads. (Pay Per View, not pay per minute)

    The content model is to view ads to read content.

    You dont get access to everything on the internet for free just because you bought an internet connection…or did I miss a meeting?

    Content is written to drive revenue, as tv shows are create to drive revenue. You would not watch a PPV tv show for free because you have a tv set…you have to pay for it.

  • http://www.optimalworks.net/ Craig Buckler

    So you’re saying that unless a person views the adverts – whether on TV or on the internet – they should not be permitted to access the programme/content? Should we also be forced to click a link and/or buy a product? After all, that’s where the revenue comes from.

    So I guess you’re now blocking people with ad blockers from your websites? Remember to block people with screen readers too … they don’t even download images.

  • tehgamecat

    No, I said if someone is paying to watch a tv show in a PPV environment you would not give them the ability to watch it for free and previously I pointed out that talking about tv is actually irrelevant in this context which you previously denied, and now confirm.

    No-one is forced to read the pages, they chose to and the price I chose for them to pay me is to have my ads on their page. I understand this is not a fair trade for you, but I do not understand why.

  • http://www.optimalworks.net/ Craig Buckler

    @PB

    If a legit file is blocked accidentally by a not “ad-like” filter, then you should report it to the filter list maintainer.

    That’s possible for some blockers – such as the ones that target specific domains – but they’re unlikely to cause problems anyway.

    Those such as Adblock are another matter. They use a list of regular expressions that you can add, edit, or remove yourself. Rather than looking at specific domains, they check the URL for advert-like strings. There isn’t necessarily a central repository or contact.

    It’s up to you how you treat the problem. If it’s content, then you may not care if someone with an ad blocker can’t view it properly. A web application or shop is a different matter – but it’s an easy problem to fix if you choose to do so.

  • http://www.optimalworks.net/ Craig Buckler

    @tehgamecat
    I’m not sure how PPV got into this, but PPV channels don’t normally show ads?!!

    My point was, on most terrestrial TV channels, the adverts don’t cost me anything unless I’m persuaded to buy something. On my metered net connection, the act of downloading an advert costs me money whether I buy something or not.

    I have never said I am against adverts – I use them on sites myself. However, neither am I against the use of ad blockers or any other technology that transforms pages for the user (screen readers, images off, script disabling, etc). In fact, switching off JavaScript blocks the majority of adverts too.

    In my opinion, blocking the blockers is futile and self-defeating.

    If you are against the use of ad blockers, have you done something about it on your sites? If not, why not?

    The purpose of this article was not to argue about the pros and cons of adverts or blocking. It was to highlight how legitimate content could be affected by ad blockers. That could be a fundamental problem in a web application or online shop, but less so for content sites.

  • tehgamecat

    Oh ok, so you dont have enough bandwidth to handle the evil ads.

    Listen, most of the civilised world is sick and tired of being weighed down by the lowest denominator. Get over it.

  • http://www.optimalworks.net/ Craig Buckler

    @tehgamecat
    Again, no one has said that adverts are evil or shouldn’t be used.

    On the contrary, you appear to have the opinion that any form of ad blocking is evil – especially on your advert-supported sites. So I’ll ask again (for a third time), what are you doing about it?…

    Having a moan and throwing insults doesn’t really count! ;-)

  • tehgamecat

    I’m not insulting you, you believe that ad blocking is totally acceptable because:

    content on the internet is paid for when you pay to gain access to the internet

    adblocking saves metered net users money

    Both are legitimate opinions. I disagree, and from there will leave it. It was a good article regardless of our opinions on adblockers, so thank you.

  • http://www.optimalworks.net/ Craig Buckler

    No, I have never said anything like that! (The whole metered bandwidth thing was just a minor aside comparison with TV – which, unlike the net, doesn’t generally charge anyone to view ads).

    My main point is this: people can view your page how they want to – not how you deem it should be. They can suppress images, CSS, JavaScript, Flash, ActiveX, adverts, or change any other aspect of their web experience. Tools such as AdBlock, GreaseMonkey, Proxomitron, etc. make this easy and many people use them whether you like it or not.

    You still haven’t said what you’re actively doing about ad blockers, so I’ll write an article showing how to hide your content from someone using one. That may please you, but be warned that it could simply lead to your site having fewer visitors and less advert revenue.

  • sname

    >>CEO: Why can’t people access our catalog or shopping cart pages?
    “I could easily fix it, but as a website developer, I do not think we should sell our products to people that do not want to look at ad’s for other companies products. If they won’t less us earn a fraction of a cent by looking at an ad, we should not let them buy from us.”

    Yea, thats a conversation I want to have.

    I want to thank Craig for this file naming heads up.

  • Snapey

    I appreciated this item, but I can’t believe the number of people that have taken it the wrong way. its not about how you might protect your advertising revenue, its about how, as a non-advert funded website, I might have content blocked by poor choice of filenames.

    Personally I don’t use adblock because I can look the other way, but I need to consider that I should check my sites with an adblock enabled browser to make sure I’m not falling foul of something I can easily avoid.