简体   繁体   中英

Migrating from Google's deprecated jsapi

I have and old website that I am now managing but haven't coded myself. The developer has integrated version 1.5.1 of jQuery with the following code from google:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1.5.1");</script>

The console is being flooded with the following error message about c.replace is not a function and also that loading modules from jsapi is deprecated. Sometimes the entire jQuery library is not loaded and the page needs to be refreshed. https://i.imgur.com/UrXvqzM.png

I tried integrating version 1.5.1 of jQuery with a cdn that is given in the console ( https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js ) as well as from from cloudflare , however because the website is using the MarkItUp plugin, there is something missing and MarkItUp isn't working. It's quite old, I know, but I can't just move to another editor. I don't know if google.load function is loading more files than just regular jQuery but I don't know how I can troubleshoot the problem and see what is missing. So, if anyone has an idea how to migrate from jsapi and load the correct jQuery version, I will much appreciate it!

I had the same problem. Just comment the two lines and add:

<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 

Choose here an existing version: Google Hosted Libraries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM