jQuery in China.

They came with this issue this afternoon. They have their e-commerce website and they have a lot of customers in China. They added a lot of things on their website that depends on jQuery. That website has got no issues when it is accessed in other countries but China. In China, all the users were not seeing any animations and pages were displaying in distorted forms and many things were not working at all. 

I understood they used either a plugin or a technique where it enabled jQuery from an outer source. I found they used a plugin which deactivated the local jQuery and it connected jQuery from Google. Why did they deactivate the local jQuery? Once again, I had to read this post “jQuery from Google” to find out why. After reading that post I understood the reason behind that updated version of jQuery. How to fix it now? 

First of all, I deactivated that plugin ( or maybe I turned this option off in that plugin which enabled jQuery from Google, maybe it was not possible for me to deactivate that plugin because it was a caching/optimization plugin they needed very much) which was connecting jQuery from Google.

Note-1: Sometimes it is seen that some users added jQuery from Google using the “functions.php” file. Please see this post, “jQuery from Google“. If it is that, please remove those lines that added jQuery from Google or if there is a plugin doing it, either deactivate/remove that plugin if that is only for that purpose or if it an option in that plugin that does it (connects jQuery from Google), simply turn it off and it is the first thing to do before we proceed.

I then visited, “https://jquery.com/download/” to download jQuery. A wide selection to choose from. I avoided the compressed and slim build version and I chose the Development version. So, I clicked on it and it showed me a page with codes, I simply right clicked on that page and clicked “save as”. It was downloaded on the hard drive as a “jquery-3.3.1.js”. Now, I would need to upload it to the “public_html” folder in the cPanel. I arrived in the cPanel and then to the “File manager->public_html”. It meant, I opened the “public_html” folder. I simply clicked “upload” which is seen at the top of the cPanel’s “File manager”. I uploaded “jquery-3.3.1.js” from the hard drive. And now, I opened “functions.php” file and added the following lines at the very bottom of that “functions.php” file. I saved the file. Here are the lines below,

function jquery_local() { 
if ( ! is_admin() ) {
wp_register_script('jquery', 'https://hiswebsite.com/jquery-3.3.1.js', array(), null, true);
add_action( 'wp_enqueue_scripts', 'jquery_local' );

Note-2: I can see it is written the following thing in those codes above.

wp_register_script('jquery', 'https://hiswebsite.com/jquery-3.3.1.js', array(), null, true);

Please change it to the site where you want to add jQuery. For example, I would add the following for “https://novicecamp.com”, 

wp_register_script('jquery', 'https://novicecamp.com/jquery-3.3.1.js', array(), null, true);

I decided to look at this image below because that might help me to remember what I did actually to download jQuery from “https://jquery.com/download/“.

I chose the “development jQuery 3.3.1” here. Note: Please choose the latest version always.

Yes, things were done well here technically, but we needed to see the output of it. One of them called to their clients in China to visit that website to see if things went well or not. He told them to visit that website from some different computers/mobile phones in China also from different areas which are very far from each other. We waited and the phone rang with positive answers from their clients in China. Things were solved. No issues were detected.

we all were satisfied and happy and we forgot about the website and we started to talk about “Ella Fitzgerald“. That Ella Fitzgerald talk was a lot better than fixing a website. 

(Please see related posts below)

One thought on “jQuery in China.

  • June 13, 2019 at 6:15 pm

    Somebody necessarily lend a hand to make significantly posts I’d state.

    That is the first time I frequented your website page and to
    this point? I amazed with the analysis you made to make this actual post
    amazing. Great job!


Leave a Reply

Your email address will not be published. Required fields are marked *