Browser JavaScript injection causes problems with a page


Browser monitoring is inserting its JavaScript instrumentation in a location that causes problems with markup or page load.


New Relic agents attempt to inject the JavaScript in the optimum location, but if you encounter problems, try these troubleshooting steps.

  1. Verify whether browser monitoring is the cause by disabling browser monitoring.

  2. If disabling browser monitoring solves the problem, investigate the source code for the page. Re-enable browser monitoring and check for the following possible issues:

    • More than one instance of the <html> tag in the page (not in an iFrame).
    • More than one instance of the <head> or <body> tag, or a missing <head> or <body> tag.
    • Occurrence of any <head> or <body> tags within the page's JavaScript.
    • Use to verify your page source, and check for serious markup validity issues or character encoding issues.
  3. Eliminate any conflicts you find by revising the page structure, disabling browser monitoring for that page, or switching to manually instrumenting via agent API for full control over script injection.

  4. If you encounter other situations, contact New Relic Support and provide an accessible link to your page or the source code for it. Ensure browser monitoring is enabled in your link or source code.