Understanding Javascript Redirects
Published November 18, 2008
A JavaScript redirect is a piece of JavaScript code that is used to automatically transfer a visitor from a landing page to a different target page. Although there may be legitimate reasons to transfer visitors and users to a different URL, generally a JavaScript redirect is employed as a sneaky method to trick search engines and direct user traffic to a website completely unrelated to a search.
JavaScript redirects and cloaking considered “black hat”
A JavaScript redirect falls under the category of “cloaking,” which is a practice of serving different results to users through search engine results. Besides redirection, another example of cloaking could be providing a web page with HTML text to a search engine, while giving a page full of images or Flash content to a user’s browser.
Web page elements like JavaScript, Flash, or other rich media files generally cannot be crawled effectively by search engines. Thus, when a page containing JavaScript is indexed by a search engine, any links hidden by JavaScript coding may not be followed by the search engine. Because of this fact, many SEO firms and underhanded webmasters may employ these “sneaky” methods to fill a web page with common search terms in order to fool a search engine and redirect the visitor to an unrelated website.
Cloaking is frowned upon by search engines. In fact, any practice of purposely deceiving a search engine in order to serve different results to a user is cause for removal from a search engine’s index. Thus, SEO companies that use software programs that auto-generate doorway web pages with search keywords for the simple purpose of redirecting a visitor with sneaky JavaScript will eventually be discovered and flagged for removal.
Yet another reason to avoid JavaScript redirection is that many users turn off the JavaScript function on their browsers. Whether your intention to redirect is legitimate or sneaky, a non-java functioning browser will simply display whatever text is on the web page, as well as the JavaScript code, and not perform the redirect.
Applicable Reasons to Redirect
There are cases, however, where there are legitimate reasons for wanting to redirect a user to a different web page:
· URL misspelling – Some users may commonly misspell a URL. Many big websites may purchase extra domains with these common misspellings and use them as a simple landing page to redirect to the actual domain. An example may be when a user types “gooogle.com” or even “googel.com” in a URL window. Despite the misspelling, users are automatically redirected to the actual “google.com” domain.
· New domain – Sometimes it is necessary for a business or website to change its name. When that results in a new domain name, it is acceptable to continue using the old domain as a redirect page to the new domain. For instance, when two businesses merge, it is likely they will use only one main domain as a consolidated website and use the other as a redirect page.
· Forwarding a .net to .com – Oftentimes a domain is purchased by a business as a .net or .biz when the more common .com is unavailable. If at some point the .com domain becomes available or is purchased by the business, they could continue using a .net as a redirect to the new domain.
What You Should Do
If you need to employ a redirect on a particular web page, remember that sneaky methods are not recommended. Even though JavaScript is an acceptable method to redirect users, search engines are becoming savvier, looking for hidden text and sneaky redirects. Google posts this basic principal on their webmaster guidelines:
Make pages primarily for users, not for search engines. Don't deceive your users or present different content to search engines than you display to users, which is commonly referred to as "cloaking."
The best way to create a redirect without looking potentially sneaky is to use an .htaccess file, such as a 301 Permanent Redirect or 302 Temporary Redirect. These codes are the most efficient and search engine friendly methods, and they will preserve your web page ranking as well. Simply create one of the following codes in a text editor and save it as a .htaccess file:
redirect 301 /filename.ext http://www.domain.tld/newfilename.ext # permanent redirect
redirect 302 /filename.ext http://www.domain.tld/newfilename.ext # temp redirect
These codes create no delay in a redirect since a server checks first for an .htaccess file. If it finds one, a browser is sent directly to the new site without loading the old page.
Redirecting user traffic from one web site to another is a common practice. If the purpose of redirect is simple and legitimate, there is no reason to use JavaScript coding. An .htaccess file works perfectly fine. Remember that cloaking and using doorway redirect web pages are considered deceptive, so only employ a redirect when absolutely necessary.
Resources:
To gain access to the most up-to-date SEO strategies, fill out the form below to sign up for our newsletter. This newsletter will help you know what Google's up to as well as how you can get your website ranking higher without raising any red flags.
{"http://www.seositecheckup.com/articles/8":{"data":[]}}
Read Related Articles About SEO Programming Topics
- How to Protect Your Website From Hackers and Cyberthugs
In a perfect world, you'd be able to mind your own business and cheerfully run a successful online business without being harassed by "cyberthugs." However, until that perfect world comes, you'll need to slap great big KEEP OUT sign on your website. This means creating security settings which will disallow access to sensitive data and controls. - How External CSS Style Sheets and External Javascript Files Can Boost Your Rankings
If you’re searching for some simple ways to increase your ranking with the search engines and provide visitors with a better user experience, external CSS style sheets and external JavaScript files might just be the answer you’re looking for. As search engine companies such as Yahoo, MSN and Google continue to consider page loading speed an important factor in determining the ranking of a website, the need to reduce load times becomes more and more important. This can be accomplished through file compression strategies such as GZIP and deflation and by optimizing graphics file sizes. - How Using GZIP Compression Helps Your Site's SEO
You might have heard some talk about how compressing your web pages helps with your site's SEO, but how does it help and how can you use it on your site? This article will provide you with some details on what file compression is and why it�s essential to the process of optimizing your site. - How Page Caching Optimizes Your Site Performance
Page caching is another method which can help you to improve the load time of your web pages and thus optimize your site for the search engines. Page load time can significantly impact your user experience and your site?s ability into convert visitors into buyers or into leads. In fact, experiments at Google have revealed that just a half second?s difference in load times can cause up to a 20% reduction in web traffic. - Static Links vs. Dynamic Links: Which Are Best for SEO?
Learn about the pros and cons behind static links and dynamic links, as well as which one is best for your SEO efforts. - Correct Your URL Canonicalization
Learn about URL Canonicalization, what it is, why it is important, and how to address this for your website. - Some Guidelines for Determining Web Page and File Size
Web page size is an important factor in determining how well optimized your site is. Search engines like MSN, Yahoo and Google are considering load time to be more and more important when it comes to both search engine optimization and PPC quality scores, and file size certainly effects your website’s load time. - Why You Need A Sitemap Protocol As Part of Your SEO
Learn about how powerful a Sitemap Protocol is in enhancing your website's search engine optimization. - How to Focus Your Content and Site Structure for Maximum SERP Results
What does the future of SEO hold? Will back links, fresh content or site structure be most important for ranking high in the search engine's? Find out what Google, MSN and Yahoo! have in mind... - SEO for Wordpress: Optimizing Your Blog With Wordpress Plug ins
A simple step by step game plan for boosting the SEO of your Wordpress blog, optimizing traffic flow and increasing visitor interactions. - The Importance of Avoiding the Use of Nested Tables
Learn about why you should avoid utilizing nested tables in your web pages from both SEO and browsing perspectives. - The Importance of a Robots.txt File for Your SEO
Your Robots.txt file is what tells the search engines which pages to access and index on your website on which pages not to. For example, if you specify in your Robots.txt file that you don't want the search engines to be able to access your thank you page... - Finding a Good Ecommerce System for Your Site
Learn exactly what you need to know to find the perfect e-commerce system for selling products and services from your website or blog...
All Categories:
- Basic SEO (19 articles)
- Online Marketing Tips (18 articles)
- On Page SEO (22 articles)
- Off Page SEO (13 articles)
- Social Media Marketing (12 articles)
- Seo Product Reviews (4 articles)
- SEO News (6 articles)
- SEO Content Creation (14 articles)
- How to Avoid SEO Pitfalls (9 articles)
- SEO Outsourcing (6 articles)
- How to Get More Traffic (10 articles)
- Advanced SEO Strategies (2 articles)
