Will Google Count Links Loaded from JavaScript Files After the Page Loads
-
Hi,
I have a simple question. If I want to put an image with a link to another site like a banner ad on my page, but do not want it counted by Google. Can I simply load the link and banner using jQuery onload from a separate .js file?
The ideal result would be for Google to index a script tag instead of a link.
-
Good Answer. I completely abandoned the banner I was thinking of using. It was from one of those directories that will list your site for free if you show their banner on your site. Their code of course had a link to them with some optimized text. I was looking for a way to display the banner without becoming a link farm for them.
Then I just decided that I did not want that kind of thing on my site even if it is in a javascript onload event if Google is going to crawl it anyway, so I just decided not to add it.
Then I started thinking about user generated links. How could I let people cite a source in a way that the user can click on without exposing my site to hosting spammy links. I originally used an ASP.Net linkbutton with a confirm button extender from the AJAX Control ToolKit that would display the url and ask the user if they wanted to go there. Then they would click the confirm button and be redirected. The problem was that the URL of the page was in the head part of the DOM.
I replaced that with a feature using a modal popup that calls a javascript function when the link button is clicked. That function then makes an ajax call to a webservice that gets the link from the database. Then the javascript writes an iframe to a div in the modal's panel. The result should be the user being able to see the source without leaving the site, but a lot of sites appear to be blocking the frame by using stuff like X-Frame-Options, so I'm probably going to use a different solution that uses the modal without the iframe. I am thinking of maybe using something like curl to grab content from the page to write to the modal panel along with a clickable link. All of this of course after the user clicks the linkbutton so none of that will be in the source code when the page loads.
-
I think what we really need to understand is, what is the purpose of hiding the link from Google? If it's to prevent the discovery of a URL or prevent the indexation of a certain page (or set of pages) - it's easier to achieve the same thing by using Meta no-index directives or wildcard-based robots.txt rules or by simply denying Gooblebot's user-agent, access to certain pages entirely
Is is that important to hide the link, or is it that you want to prevent access to certain URLs from within Google's SERPs? Another option is obviously to block users / sessions referred from Google (specifically) from accessing the pages. There's lots can be done, but a bit of context would be cool
By the way, no-follow does not prevent Google from following links. It actually just stops PageRank from passing across. I know, it was named wrong
-
What about a form action? Where instead of an a element with a href attribute you add a form element with an action attribute to what the href would be in a link.
-
Thanks for that answer. You obviously know a lot about this issue. I guess they would be able to tell if the .js script file creates an a element with a specific href attribute and then add that element to a specific div tag after the page loads.
It sounds like it might be easier just to nofollow those links instead of going to all the trouble to redirect the .js file whenever Google Bot crawls the page. I fear that could be considered cloaking.
Another possibility would be a an alert that requires a user interaction before grabbing a url from a database. The user would click on the link without an href, the javascript onclick fires, the javascript grabs the the url from a database, the user is asked to click a button if they want to proceed, and then the user is redirected to the external url. That should keep the external URL out of the script code.
-
Google can crawl JavaScript and its contents, but most of the time they are unlikely to do so. In order to do this, Google has to do more than just a basic source code scrape. Like everyone else seeking to scrape data from inside of generated elements, Google has to actually check the modified source-code, after all of the scripts have run (the render) rather than the base (non-modified) source code before any scripts fire
Google's mission is to index the web. There's no doubt that, non-rendered crawls (which do not contain the generated HTML output of scripts) can be done in a fraction of the time it takes to get a rendered snapshot of the page-code. On average I have found rendered crawling to take 7x to 10x longer than basic source scraping
What we have found is that Google are indeed, capable of crawling generated text and links and stuff... but they won't do this all the time, or for everyone. Those resources are more precious to Google and they crawl more sparingly in that manner
If you deployed the link in the manner which you have described, my anticipation is that Google would not notice or evaluate the link for a month or two (if you're not super popular). Eventually, they would determine the presence of the link - at which point it would be factored and / or evaluated
I suppose you could embed the script as a link to a '.js' module, and then use Robots.txt to ban Google from crawling that particular JavaScript file. If they chose to obey that directive, the link would pretty much remain hidden from them. But remember, it's only a directive!
If you wanted to be super harsh you could block Googlebot (user agent) from that JS file and do something like, 301 them to the homepage when they tried to access it (instead of allowing them to open and read the JS file). That would be pretty hardcore but would stand a higher chance of actually working
Think about this kind of stuff though. It would be pretty irregular to go to such extremes and I'm not certain what the consequences of such action(s) would be
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Will page be marked as 404 if you replace country specific letters from url?
What I'm reffering to is replacement of Polish characters from i.e "Ĺ‚" to "l" or "Ä™" to "e". I believe it relates same way as other similar Slavic languages.
On-Page Optimization | | Optimal_Strategies0 -
Async JavaScript page load times affect on ranking.
Our company plan to use in our product page a live chat support app. But  I concern about the page load time. The script is loading asynchronous and in the inner tests increase the average page load time with around one sec. Previously the load time was between 2.5-3.3 sec after the chat support increased to 3.8-5 sec, but sometimes there was extreme +10 sec worse results. My question is how much can this impact to our search engine rankings?
On-Page Optimization | | laszlo_muhi0 -
Too Many on page links on my homepage question?
Question, on moz analytics, for my homepage, I've gotten the " Too many on page links" notification every crawl. I've always ignored it because i didnt think it affected ranking or anything really. The on page links on the bottom of our homepage are landing pages. Most users reach those pages by searching those specific pages on google. We just decided to put them on the bottom of our page for unknown reasons. My question is, should i remove the landing pages on the bottom of our homepage? WIll it improve search rankings for my homepage? if i do remove them, should i put the landing pages on another page besides the homepage? Does google index my website better without the on page links on my homepage? My website is- prestigeluxuryrentals.com
On-Page Optimization | | prestigeluxuryrentals.com0 -
To create extra pages, or not to create extra pages?
I'm responsible for a site where we cater for all kinds of medical & legal problems. I recently conducted keyword research that shows a lot of questions being 'asked' in relation to the conditions we cater for. Naturally, I want to create content to answer these questions. We have a page for 'Cancer compensation' - the 'possible content' that answers questions won't necessarily help someone claiming compensation for cancer mistreatment, BUT someone who asks a question relating to cancer, answered in the 'possible content' may find the 'cancer compensation' page useful. SO! Do I: Add this content to the existing 'cancer compensation' page? Create individual pages of content answering each question, linking to the 'cancer compensation' page? or do I amalgamate all the answers into one heafty 'resource' page that sits elsewhere on the site? What do you think? Thanks in advance. John King
On-Page Optimization | | Muhammad-Isap0 -
Wordpress Post as Slideshow - One long page vs many short pages?
We are working on implementing a slideshow format for some of the posts on a website, and it appears that using this format breaks a long post into several shorter pages. That's what we want from a user experience standpoint, but are wondering if there are negative SEO implications from having the content broken up in this way, and whether search engines will view it as one longer page or several very short pages? Here is an example:Â http://www.forthebestrate.com/10-cheap-ideas-for-summer-fun/ Thanks for the help!
On-Page Optimization | | ILM_Marketing0 -
Which pages on my site should I back link to
The majority of the back links I have been creating link directly to our home page and to the store page. Is this the best approach or should I be trying to spread the links throughout our site to include product categories and subcategories etc?
On-Page Optimization | | Hardley0 -
Internal Linking
Hi Everyone, Should i be careful of how many internal links I have on one page? For example if i have a page that contains 700 words, can i have 5, 10, 15 internal links linking to other pages on my website? Is there a ratio for best practice. I know that internal linking is important for spiders to crawl your website but at the same time dont make it look spammy. I hope this makes sense. Thanks for any help.
On-Page Optimization | | Paul780 -
Will a large percentage of 404 links negatively impact SERP performance?
We discovered a broken link and issue with a dynamically generated sitemap that resulted in 9,000+ pages of duplicate content (namely there was not actual 404 page, but content for a 404 page that populated on the broken page). We've corrected that issue so the 404 page is working correctly now and there aren't any more broken links on the site. However, we just reviewed our Google crawl report, and saw that now there are 9,000+ 404 links in the Google index. We discovered the initial error when our SERP performance dropped 60% in a month. Now that we've corrected all the duplicate content pages, will vast number of 404 pages negatively impact SERP results? If so, do you recommend doing 301 redirects to the page it should have gone to, and do you know of any automated tools performing the 301's (it's a standard HTML site, no CMS involved). Thanks for your help!
On-Page Optimization | | DirectiveGroup0