Wordpress Uncaught SyntaxError: Unexpected Token Illegal - wordpress

I have a local install of Wordpress running & I am suddenly getting these errors in my console:
Uncaught SyntaxError: Unexpected token ILLEGAL
media-upload.php:75Uncaught ReferenceError: jQuery is not defined
media-upload.php:89Uncaught ReferenceError: SWFUpload is not defined
media-upload.php:156Uncaught ReferenceError: jQuery is not defined
load-scripts.php:1Uncaught SyntaxError: Unexpected token ILLEGAL
Non-wordpress site's work fine and I've never had any issues like this before, it seems to be limited to Wordpress.
What I don't understand is that the modal window is being called and loading AJAX content, additionally all the transitions work in the rest of the Wordpress admin area.
Does anyone have any suggestions?
Thanks

I had a similar problem. Disable magic_quotes_gpc, magic_quotes_runtime, magic_quotes_sybase in PHP administration console or php.ini. This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. You can also disable dynamic content compression with IIS administrative console. Then reset your browser cache.

I had this problem also, but clearing the browser, cache (Chrome) with SHIFT+F5 had reloaded the scripts and solved the problem.
Refresh the cache for every page where you encounter the problem.

Related

QWebEngine hinders github navigation by default

I'm working on a web browser and without changing any QWebEngineSettings, github can't load the necessary javascript.
QWebEngines javascript output when visiting github
The Content-Security-Policy directive 'worker-src' is implemented behind a flag which is currently disabled.
Uncaught TypeError: this.toggleAttribute is not a function
Uncaught TypeError: this.toggleAttribute is not a function
Uncaught (in promise) ReferenceError: AbortController is not defined
...
And so on, I've tried setting
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, true);
And made sure they are enabled, yet without any success. Do anyone happen to know which security policy I have to change to make github work?
Upgrading from Qt 5.9.9 to 5.15.0 solved the issue.

CRA precache fails because of .LICENSE extension

So, we have a situation where in production the precache is failing on our PWA because of a weird .LICENSE file on our server that is giving us 404
specifically an error like this
uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url"
How we can fix that?
Well, the fix is simple.
Our web-server returns only known file extensions, and .LICENSE is not one of them.
Just enable the ServeUnknownFileTypes flag on your StaticFileServer options info

Firebase works on custom web app but not on wordpress : Uncaught ReferenceError: firebase is not defined

I am trying to add my firebase project to my wordpress website (following the official documentation) but got Uncaught ReferenceError: firebase is not defined
I tried adding firebase, the same way, to a custom web app and it worked.
I added the code snippet provided by Firebase, in the body tag (as recommended by Google). You can check the code on the website : https://testing.myfprod.fr
It worked instantly on my custom web project but I am still getting the error Uncaught ReferenceError: firebase is not defined on wordpress.
Unfortunately I did not find an answer, in a previously asked question, that could solve my problem.
I found out that LSCache was configured to defer js script. I disabled this option and it now works.

Response for preflight has invalid HTTP status code 401 preflight OPTION call error

I'm working with Ionic 3 framework project and have encountered one error whenever i m trying to send my data to the server by POST method (as postAsync), this is related to the OPTION call as the error says:
Response for preflight has invalid HTTP status code 401
I don't know how to solve this error, as I have added CORS extension to my browser, still I'm facing this error issue.
Is there any solution to solve this issue from browser side like from chrome devtools as i can filter it from network by -mode:OPTIONS but at console I'm having the same error.
If this not possible, then how to solve this error ?
Code:
this.WooCommerce.postAsync('customers', customerData).then( (data) => {...}
More error messages:
polyfills.js:3 OPTIONS tusharstar.freesite.host/wc-api/v3/…... 401
(Unauthorized) (anonymous) # polyfills.js:3 ... (index):1 Failed to
load tusharstar.freesite.host/wc-api/v3/…) Response for preflight has
invalid HTTP status code 401 bluebird.js:1545 Unhandled rejection
TypeError: Failed to fetch
After googling a lot and i really mean a lot, the answer to my 1st point is yes! It is all about the web security issue/precaution which lets the developer get the error/precaution point of OPTION call with chrome browser. Simple way to solve the problem (just for development purpose) is to disable web security for browser, restart chrome with new extension of disabled web security .exe and everything will work fine. Steps for windows user:
1.Close chrome.
2.Open cmd
3.add this code:
C:/Program File/Google/Chrome/Application>chrome.exe --disable-web-security --user-data-dir="D:\chrome"
You can get through this very easy! Let's follow me right now
Create a shortcut on your desktop
Right-click on the shortcut and click Properties
Edit the Target property
Set it to "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --5. disable-web-security --user-data-dir="C:/ChromeDevSession"
In VIsual Studio Code, run ionic serve -l
You're gonna see new tab open http://localhost:8100/ionic-lab. You should be aware that this link is opened in the normal chrome tab, not the "disable-web-security" chrome we have set up.
Double click to the shortcut that we have set up to open the "disable-web-security" chrome tab. Then paste http://localhost:8100/ionic-lab into this tab.
So the reason that we get multiple errors when working with woo-commerce-api is this "web-security" by Google. Then you just disable it and you actually don't need any CORS Extensions. So remove them right now if you have installed.
And this solution i write for people who learn this course https://www.udemy.com/ionic-3-apps-for-woocommerce-build-an-ecommerce-mobile-app/. This is an ionic e-commerce app that using woo-commerce-api to set and get data from Wordpress (local or live server). If you have trouble in other language not ionic, it still works fine.
Actually i have done a lot of searchings on Google to find this solution. I hope this helps all of you. Now, i need to go to bed because tomorrow i have a final report about this ionic project with my lecturer 😃
See ya!
Quy Le
I had the same problem and I solved it by adding some lines of code in the top of .htaccess file of my WordPress root path (C:\xampp\htdocs\wordpress)
Add this code in the top of your .htaccess file :
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $l [R=200,L]

Bug on Chrome while implementing gconnect module in drupal 7

i'm using this module to connect from Gmail to my site, it's working greate on firefox but on chrome the button (Sign in Using Google) is not appearing..
if i go to console, i found a javascript error on the file:
(http://localhost/mysite/sites/all/modules/gconnect/git-for-drupal.js?o) on the line 6:
Uncaught TypeError: Cannot read property 'config' of undefined
Also i am getting an error in Importer.js on line 2035: uncaught syntaxerror unexpected identifier
Please help in solving this issue, http://drupal.org/node/1807348
It happens in my drupal and i installed a Jquery update module link below, and change my jquery version it works great. I think default drupal jquery version is 1.4.
https://www.drupal.org/project/jquery_update
Also if you need use jquery's Browser function you have to add extra js to your file.
jQuery.browser() removed
The jQuery.browser() method has been deprecated since jQuery 1.3 and is removed in 1.9. If you still need this function, you can get one js file from: https://github.com/gabceb/jquery-browser-plugin and link the js to your file.

Resources