Solved: “Custom JavaScript is not allowed” (Google Search Console – AMP issue)

AMP (Accelerated Mobile Pages) is an initiative to make web pages faster and more compatible across different devices and browsers. It is lead by AMP Project. A library is provided for web developers. In this post, I will explain how to fix a popular AMP issue.

Google supports AMP Project and provides tools and guidance to integrate AMP web pages with Google tools such as Search and Analytics (Receiving an issue with cookies while using Google services? Check out this blog post).

You can check if your website is AMP-ready by using Google Search Console. If there are any issues in any of your web pages, an error message will be displayed in Search Console Dashboard. Here is one of the error messages displayed most:

Custom JavaScript is not allowed

<script>'undefined'=== typeof _trfq || (window._trfq = []);'undefined'=== typeof _trfd && (window._trfd=[]),_trfd.push({'tccl.baseHost':'secureserver.net'}),_trfd.push({'ap':'cpsh'},{'server':'xx'}) // Monitoring performance to make your website faster. If you want to opt-out, please contact web hosting support.</script><script src='https://img1.wsimg.com/tcc/tcc_l.combined.1.0.6.min.js'></script></html>

Search Console Custom JavaScript is not allowed AMP issue

Solution for “Custom JavaScript is not allowed” AMP issue

The root cause of this problem is that the feedback code implemented to your page by your hosting provider (It’s GoDaddy in my case).

As mentioned in the page code (If you want to opt-out, please contact web hosting support), GoDaddy recommends contacting Customer Support to fix this problem. However, you can make necessary configuration by yourself. You just need access to your website’s control panel on GoDaddy.

Follow the steps below to fix this issue for websites hosted by GoDaddy:

  1. Login to your control panel
  2. Click the details icon (three dots in a row “…”) on the top right side of the page
    GoDaddy control panel AMP issue
  3. Click “Help us”
  4. Click “Opt out”
    GoDaddy opt-out AMP issue

After opting out from the feedback system, click “Validate Fix” button in your Google Search Console. Then you should patiently wait. It may take a few days from Google to scan your pages and mark the issue as fixed.

You can always go back to the same page and opt in for feedback back.

How to find out processor architecture (x86, x64) of dll and exe files?

Using an assembly that has a different processor architecture than your web project may cause your application to throw compatibility errors. Imagine your ASP.NET application targets 32-bit processors but you try to reference a 64-bit Oracle.DataAccess.dll. You will receive an error message such as “Could not load file or assembly” or “Provider is not compatible“.

In order to fix compatibility errors, you need to make sure the processor architecture of your assembly files (dll files). This seems like a complicated task but it’s actually pretty straightforward if you know where to look at.

I will explain 5 quick ways to find out the processor architecture of an assembly file.

Are you looking for how to find public key token value of an assembly file. Check this post out.

5 ways to find out the processor architecture of an assembly file

1. Use Notepad

Yes, it’s as easy as using Windows Notepad. Follow the steps below:

  • Open Notepad (Start > Search > Notepad)
  • Go to “File > Open”
  • Select “All files” from the drop-down list
  • Select the file
  • Find the letters PE. Check the letter next to it
    • If it is PE L, it’s 32-bit (x86)
    • If it is PE d†, it is 64-bit (x64)
processor architecture notepad
32bit DLL file
x86 x64 dll assembly exe
64bit DLL file

Thank you Alexander Revo for this brilliant method.

2. Use 7-Zip

Another easy way of finding out processor type is that using 7-Zip which is a popular file achiever that is installed in majority of users. Follow easy the steps below.

  • Right click the file. Click “7-Zip > Open archive”
  • Click “Info” (yellow icon on the top menu)
  • You will see the processor information next to “CPU:”

7-zip processor info dll exe

3. Use Dumpbin

If you have Visual Studio installed, you can use Dumpbin utility to display properties of your assembly files. Make sure to use it with /headers option. Follow the steps below to use Dumpbin:

  • Go to “Start > Visual Studio > Visual Studio Tools > Developer Command Prompt”
  • Run the command below. Make sure the specify correct path of your DLL file
dumpbin /headers Oracle.DataAccess.dll

Dumpbin assembly dll info

4. Use Sigcheck

Another useful Microsoft utility is Sigcheck. You can download it quickly from Microsoft’s website. Follow the steps below to use Sigcheck for finding processor architecture of your dll and exe files.

  • Download Sigcheck and unzip it
  • Open Command Prompt and go to the path of the unzipped folder
  • Run the command below
sigcheck Oracle.DataAccess.dll

sigcheck machine type5. Use Dependency Walker

My last recommendation is a third-party tool: Dependency Walker. It’s a free utility to view properties of your dll, exe, and other Windows modules. It creates a hierarchical tree diagram for the file you select.

  • Download and run Dependency Walker
  • Go to “File > Open” and select the file
  • Look for CPU column (It may give an error for 32-bit files. Click “OK” and check the result window)

dependency walker CPU

References:

 

 

How to find out the Public Key Token for an assembly (DLL) file?

In your ASP.NET project, you may need to use public key token of an assembly file while adding it as a reference. Here is an example reference declaration from project.csproj file:

<Reference Include="Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86">
  <SpecificVersion>False</SpecificVersion> 
  <HintPath>\bin\Oracle.DataAccess.dll</HintPath>
</Reference>

As specified in Microsoft’s documentation, publicKeyToken field is optional. However, it is recommended to use it for a strong mapping of your assemblies.

Before going further; What is the public key token? A good description:

The public key token is a small number which is a convenient “token” representing a public key. Public keys are quite long; the purpose of the public key token is to let you refer to keys without saying the whole key.

The question comes up at this point: How to find out this value?

Find public key token value of an assembly file

The easiest way of finding out this value is that using Strong Name Tool. It is used for assembly signing, key management, signature generation and verification. Strong Name Tool is automatically installed with Visual Studio.

Follow the steps below to get values from your assembly file:

  1. Open Visual Studio Command Prompt (Start > Visual Studio > Visual Studio Tools > Developer Command Prompt)
  2. Run the command below. It will display both public key token and public key. Make sure to replace C:\Temp\Oracle.DataAccess.dll with the full path of your DLL file
sn -Tp C:\Temp\Oracle.DataAccess.dll

Assembly public key token

If you only want to see the public key token, you can only use -T parameter.

sn -T C:\Temp\Oracle.DataAccess.dll

Even if you configure everything correctly, you may run into “Could not load file or assembly” issue. Read about Assembly Binding Logging to troubleshoot these kind of issues.

Alternative Way (PowerShell)

If you don’t have Visual Studio installed, you can display the same information by using a PowerShell command. Follow the steps below to to view this information.

  1. Open PowerShell (Start > Search > PowerShell)
  2. Run the command below. Make sure to replace C:\Temp\Oracle.DataAccess.dll with the full path of your DLL file
([system.reflection.assembly]::loadfile("C:\Temp\Oracle.DataAccess.dll")).FullName

DLL public key token powershell

Reference: