The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. On-Page / Site Optimization
    4. Scripts question

    Scripts question

    On-Page / Site Optimization
    6 2 241
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lojdqvist
      lojdqvist last edited by

      My question is whether search engines will crawl the page before or after scripts run on the page. I have a H1 that will be replaced with a canvas by jquery script. Will search engines see the H1 or the canvas?

      1 Reply Last reply Reply Quote 0
      • Solvari
        Solvari last edited by

        Hi,

        Search engines will index the final html, not the scripts that generate the html.

        lojdqvist 1 Reply Last reply Reply Quote 0
        • lojdqvist
          lojdqvist @Solvari last edited by

          Thanks, but can you please be more specific? Do you mean that search engines runs the scripts, then sees the final html – as in the html after scripts are executed? Or that they don’t run the scripts, so the “final html” is what we see in “view source” before the page is “finished” and scripts are executed?

          Seems strange that Google would execute scripts. Wouldn’t that be a security risk?

          Solvari lojdqvist 3 Replies Last reply Reply Quote 0
          • Solvari
            Solvari @lojdqvist last edited by

            Google doen't run your script, this happens on your server. When Google wants to crawl a page, it requests this url from your server. The server will run the scripts and deliver the final html to the Google crawler. This code is equal to what you see in 'view source'.

            I hope this explains it a bit more.

            1 Reply Last reply Reply Quote 0
            • lojdqvist
              lojdqvist @lojdqvist last edited by

              Sorry but I'm still a bit confused.

              By ”this code is equal to what you see in ’view source’”, do you actually mean “view source” or “view generated source”? Because “View source” would imply that Google sees the un-scripted html.

              Could you really run javascript on a server? Do you mean that our server will run a client javascript before sending it to Google..? (Let’s say we add an A href tag dynamically by javascript, will this A tag be crawled by Google?)

              Thanks!

              1 Reply Last reply Reply Quote 0
              • Solvari
                Solvari @lojdqvist last edited by

                I mean 'view source' not generated source. What I tried to say is that Google will see exactly the same code as you do when you right click on a page and click 'View source code'. So to answer your first question _' I have a H1 that will be replaced with a canvas by jquery script. Will search engines see the H1 or the canvas?'  _Just check the source code of your page to find out.

                Javascript/ajax can cause problems for Google to index the content as far I know, but I'm not an expert in this.

                1 Reply Last reply Reply Quote 1
                • 1 / 1
                • First post
                  Last post
                • SEO question
                  Izenra
                  Izenra
                  0
                  5
                  50

                • Schema Question
                  meqdiw46ao
                  meqdiw46ao
                  0
                  3
                  239

                • URL question
                  Christy-Correll
                  Christy-Correll
                  0
                  5
                  99

                • A question on cached pages
                  MashBonigala
                  MashBonigala
                  0
                  5
                  77

                • Question about URLs
                  Juandbbam
                  Juandbbam
                  0
                  5
                  250

                • Quick Question on Redirects
                  RyanKent
                  RyanKent
                  0
                  2
                  251

                • Newbie with a few questions
                  cfguti
                  cfguti
                  0
                  4
                  426

                • URL question
                  spytunes
                  spytunes
                  0
                  3
                  896

                Get started with Moz Pro!

                Unlock the power of advanced SEO tools and data-driven insights.

                Start my free trial
                Products
                • Moz Pro
                • Moz Local
                • Moz API
                • Moz Data
                • STAT
                • Product Updates
                Moz Solutions
                • SMB Solutions
                • Agency Solutions
                • Enterprise Solutions
                • Digital Marketers
                Free SEO Tools
                • Domain Authority Checker
                • Link Explorer
                • Keyword Explorer
                • Competitive Research
                • Brand Authority Checker
                • Local Citation Checker
                • MozBar Extension
                • MozCast
                Resources
                • Blog
                • SEO Learning Center
                • Help Hub
                • Beginner's Guide to SEO
                • How-to Guides
                • Moz Academy
                • API Docs
                About Moz
                • About
                • Team
                • Careers
                • Contact
                Why Moz
                • Case Studies
                • Testimonials
                Get Involved
                • Become an Affiliate
                • MozCon
                • Webinars
                • Practical Marketer Series
                • MozPod
                Connect with us

                Contact the Help team

                Join our newsletter
                Moz logo
                © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                • Accessibility
                • Terms of Use
                • Privacy