Blog

JavaScript vs. Iframes- Which Is Best for SEO?

In this digital era, people use search engines, such as Google, to determine who they contact, where they shop and how much money they spend on anything they need to purchase. Consequently, many businesses have made their transition to the internet.

As an entrepreneur, search engine optimization (SEO) helps you to reach potential customers who are actively searching out information that relates to your products and services. Therefore, understanding the potential impact JavaScript and iframes can have on SEO is a vital to giving your site the best ranking possible.

Odds are, you may not realize what either is or how they work. Take a look to better understand both and how they affect your SEO. Then, you can decide which one works best for your needs.

JavaScript

The relationship between JavaScript and SEO is highly debated in SEO circles. While Google maintains that they can render JavaScript websites, some professionals claim that this programming language is too arcane to execute.

So, who is telling the truth? Can search engines rank a website made in JavaScript? Before we answer these questions, let’s first explore the following:

  • How JavaScript works
  • How a site using JS can be crawled, indexed and then ranked
  • Whether search engines can execute all these activities for a site that uses JavaScript code

How JavaScript works

JavaScript creates interactive web pages by using frameworks to control the behavior of different elements on the page.

In the past, JS was only ideal for front-end (client-side) browser. These days, the code can be embedded on other host software like server-side in website servers as well as databases.

JavaScript problems started when its implementation still relied on client-side rendering. As a solution, JavaScript frameworks with server-side rendering emerged to solve the problem way before it arises.

To understand why problems occur and how you can prevent them, you need to have some basic skills on how search engines work. Let’s have a look at the information retrieval phases: crawling, indexing, and ranking.

Crawling, indexing and ranking

Crawling is the discovery phase. It is a rather complicated process that uses software programs known as spiders or web crawlers.  A popular example of a web crawler is Google bot.

Here is what the process looks like:

A crawler fetches web pages. It then follows the links on these pages and the process continues until the pages are indexed.  During indexing, the crawler uses a parsing module that analyzes code and extracts URLs in the <ahref=”…”> script without rendering them. Web crawlers can validate HTML codes and hyperlinks.

You can use a "robots.txt" file to assist Google in finding the pages to crawl. This file communicates to search engines on whether they should access and crawl your entire site or just some parts of it.

The indexing phase involves analyzing the URL to understand its contents and relevance. The indexer also attempts to render the pages and execute JavaScript with a web rendering service.

The crawling and indexing phase work together. The crawler sends its findings to the indexer which in turn prioritizes the URLs according to their high value and feeds more URLs to the crawler.

Once this stage is complete, and there are no errors in the search console, the ranking process begins. At this point, Onsite SEO experts and webmasters must offer quality content, optimize the website and build valuable links.

Of course, search engines have numerous measurements when it comes to a site or page's ultimate ranking. For more insight into how Google ranks content, Backlinko has created a list of 200 ranking factors, which was current as of late 2018. This will help you further create the right content to rank higher.

JavaScript and SEO

JavaScript means faster server load and more loading time speed. With JavaScript, code functions run immediately. They do not wait for the server to answer. It also leads to higher versatility, easier implementation, and richer interfaces. Unfortunately, JavaScript also brings SEO some issues. Especially if your webmaster fails to optimize your JavaScript code.

While search engines love sites and pages that load faster, other issues can cancel out this benefit. Of course, as a site owner, you'll love how easy JavaScript is to implement. The key is finding the right balance for you and search engines.

It is essential for webmasters to know that it is the indexer and not the web crawler that takes care of JavaScript.  With this knowledge, they can correct any errors that occur and obtain the desired outcome which is Google ranking website pages.

When search engines initially index a page, they do a quick sweep for content. Since JavaScript needs a second to load, search engines may only see a blank page at first. This is why your code needs to be reworked to be more SEO-friendly. Otherwise, Google only sees a template of your site instead of any actual content.

One of the best ways to do this is to use the Fetch as Google tool. You can also a variety of tools and frameworks, such as:

  • SEO.JS
  • Angular JS SEO
  • Backbone JS SEO
  • BromBone
  • Prerender

So, yes JavaScript can be SEO-friendly, but it may take a little extra work.

Iframes

Iframes (inline frames) are part of the HTML syntax. They allow you to embed another site on your website's code. As such, it enables you to use resources from other sites without duplicating content.

For instance, you can use iframes to embed maps from Google, slideshows from SlideShare, engaging AI Chatbots, and videos from YouTube as well as content for advertisement.

Initially, the challenge with iframes was that search engines were unable to crawl iframe content. Users could see the content but robots couldn't.  Also, robots were unable to leave the iframes once they entered. This meant they were stuck and weren't able to see any other content on your site.

These days, web crawlers can travel freely between iframes and regular website content. Just like when using JavaScript, you can make it easier for search engines to access the content in your iframes using robot.txt. Google even talks about these challenges during a Google Hangouts session.

Iframes and cloaking

A common myth about iframes is they are used as a form of cloaking. This risky technique is used to obscure poor quality content by showing search engines a completely different set of content than what users actually see. As you might have guessed, this approach can have negative impacts on your search engine ranking as it defeats the purpose of ranking.

Mainly, users quickly leave your site when the content isn't what they expect. Even if you do fool search engines temporarily, they figure out there's an issue when you have an extremely high bounce rate.

Search engines have changed drastically in the last decade to cut down on blackhat SEO practices. Think of cloaking as being just as bad as buying backlinks and keyword stuffing. All of these will drop your site in search rankings and possibly even get it blacklisted, which is difficult to come back from.

Iframes are distinct from cloaking. They mark the source of their content in the HTML syntax. Search engines, therefore, understand that the content seen by users is similar to the content referred to in the source URL. This is a legitimate method for providing quality content to users.

Iframes and search engine rankings

Can Iframes affect your site ranking? Search engines consider the content in frames to belong to another website. This means having them doesn't really affect your search engine ranking, for better or worse. However, you can assign iframe content a different URL to make it appear to search engines as a link on your site versus a completely different website.

There is one way where iframes may hurt your site rank. Since search engines see them as a separate URL, placing your best content and resources in them may result in the iframe content being seen as a competitor.

Overall, it's better to focus on placing high-quality content on your website and not just in iframes. While you can still use iframes, use them for less important content. Remember, you want your main site to rank high and not let your iframes take away your ranking power.

Some site owners use iframes for additional or secondary content. This gives users extra content, but ensures search engines see the highest quality content as coming from the parent site and not a competitor.

Finally

So which is better for SEO - JavaScript or iframes? As we have highlighted above, iframes generally do not affect SEO. However, since they contain content from other sites, you should avoid using them on website pages that you consider important.

On the other hand, Google sometimes may have problems dealing with JavaScript content. However, with proper implementation and use of a few tools and plugins, it is possible to have your content rank high in search engines.

It's important to note that search engines can and do crawl content whether you use JavaScript or iframes. The key is to make sure search engines see the right content and rank it accordingly. This may take some tweaks to your site and determining what type of content to use in iframes.

The reason we wanted to explain all of this is to help you better understand how our brandable social media aggregator affects your SEO. Many of our competitors prefer to use iframes. However, we use JavaScript to make it much easier for search engines.

Our code is already optimized to be search engine friendly. All you have to do is add it to your site and enjoy the SEO benefits that come from all your social media interactions.

To find out how else our brandable social media aggregator can benefit you, signup for a free Curator.io account or request our demo today.

Image: Charles PH