I've got a wordpress site with jquery cookie plugin installed. It used to work fine. For a little while, i've been working with a content that didn't require the plugin. Meanwhile, i've started using cloudflare.
Today, I tried adding content that utilizes that plugin, and suddenly got an error saying "Uncaught TypeError: $.cookie is not a function".
Obviously, the plugin is not loading. What i've done first is, i've moved that plugin from a separate file into header. Right above the script that utilizes it. No luck. I figured, it could still be showing cloudflare cached version, so, i've deleted cache and minified scripts & css. Still no luck. And now I'm stuck.
I know that people here like some code to be provided, but as you can understand, there is a lot of it.
Is it possible that $.cookie is being called before it is loaded? Or that CloudFlare force the loading of a jQuery asset whose version isn't compatible with your cookie plugin?
Looks like disabling cloud flare took a while. Works fine now.
Related
We have a CS-Cart store that we recently moved the directories on. After the move, we have found that the Javascript on the home page is not working correctly. A number of $(document).ready() events aren't working correctly and are throwing a TypeError: $ is not a function error.
After stepping through the concatenated file, we have narrowed the problem down. The file is processed correctly but after the first $(document).ready() event is called, jQuery seems to unassign itself. IE both the jQuery and $ variables are unset.
We have access to a wayback machine copy of the site and that seems to work properly. If we copy the old javascript file across though, we get the same error. This fact seems to suggest that it is some other mechanism that is causing the problem.
Is there a known mechanism that CS-Cart or jQuery will unassign the jQuery variables?
So it turns out that the MailChimp embed code was old and the jQuery noConflict method was causing the issues. Once we turned the embed code off, everything worked as expected.
After updating to Wordpress 4.8 widgets stop working, I mean the textarea inside has disappeared and I read the following error in console:
ReferenceError: Can't find variable: wp
Global Code — widgets.php:202
Looking into the file I see the line causing the issue:
wp.mediaWidgets.init();
and so on. There are other blocks related to the wp variable but I really cannot understand why it's happening considering that I've already tried to disable all plugins without success. Any advice?
Thanks.
How did you update to 4.8? You might try manually updating WordPress. Your issue could be from inconsistent versions of some files. Source
Check out these instructions.
If this doesn't work, can you say which widgets.php file is causing the problem? I noticed there were a few files with that name in the codebase.
I actually solved manually restoring the Wordpress core and cleaning the wp-config.php. Furthermore there was a function in my theme deferring javascript and that was the main cause, most likely.
I am learning to build a web application using a Lynda tutorial. They have provided a sample application, which in their tutorial looks like this when loaded into Safari:
but when I try to open the same html file it shows up like this: (the only browser option is chrome, because it says it is a Chrome HTML
I am very new to web development, and I am not sure what could be causing this problem. I already disabled my AdBlock. I am using Windows 10 but the tutorial is using a Mac.
Thank you!!
Looks like your Stylesheets aren't loading, make sure you have linked the right files in your head's link elements.
Make sure your stylesheets are linked correctly. Learn the difference between relative and absolute links.
Ad Block won't affect anything, and your OS wouldn't have this much of an impact on the site not loading correctly. Posting your code generally helps us out a ton! At the very least, would you mind posting your stylesheet links, so that we could help you get those right?
currently, I'm facing the same problem. here the quick solution, use Microsoft Visual Studio code editor and install a plugin called "Live Server".
what I'm facing is if I open Html file using "live server" it is working, if I directly opening in the browser it is not loading the CSS properly.
site: https://opalschool.org/
I'm seeing a lot of 403 errors on a site of mine, and I see JavaScript errors in Google Developer Tools console that always show a double forward slash in different plugin URLs:
Failed to load resource: the server responded with a status of 403 ()
https://opalschool.org/wp-content/plugins/wp-smush-pro//assets/shared-ui/wdev-ui.css?ver=1.0 Failed to load resource: the server responded with a status of 403 ()
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,plupload&ver=6c00de4……:9 JQMIGRATE: Migrate is installed, version 1.4.1
When I am viewing the admin page for Smush Pro I get the above errors, and the editing buttons are not available... this makes sense since the double slash is keeping some assets from loading. I've tested and removing the double slash before the assets/ folder reveals the files are there.
I see the same thing happen for some other plugins too (learndash), and I just installed WP Smush Pro on this site today. So I know the issue has been happening for a bit.
I have tried the following with no success:
changing the .htaccess file
re-saving permalinks
turning off redirect related plugins
searching the database for " //assets/" in links to try to change any that may have been written incorrectly but were lingering
I have a staging site copy of the live site that is a recent copy in the last few days, and it does not show the errors. I have tried comparing plugins on both sites and not found any causes. I may get further with this comparison, but haven't had that much time on it yet.
JQMIGRATE: Migrate is installed, version 1.4.1 -
WordPress uses the jQuery migrate script to ensure backwards compatibility for any plugins or themes you might be using which use functionality removed from newer versions of jQuery.
First try to deactivate all you plugins
Then activate one plugin and check it whether it is showing error or not
Repeat this for all you plugins then you will able to find which plugin is creating this problem.
The removing plugins troubleshooting method didn't provide results.
I believe now it may have been due to running the Hummingbird plugin from WPMUDEV. WPMUDEV has indicated it could be due to their plugin, and they said they'd roll out a fix with the next version if it is.
WPMUDEV pointed to a spot in the code to remove the "/" that seemed to be causing the issue in the Smush Pro plugin's path to the assets folder. That fixed the issues with the Smush admin area not showing it's settings toggles. The only other plugin affected seems to be LearnDash, but so far I haven't figured out where to edit out a slash to fix the assets path and remove the error from the console.
I work on an ASP.NET MVC 4 application.
I updated jQuery, jQuery UI and all other nuget packages in my project. Built it and ran it to see that no problems occured. Everything worked so I continiued development for several days.
After a while I published the project to a test-server I have to see how it looked on Ipad, Iphone etc. And then I realized that the jQuery-UI accordion stopped working.
It renders, but does not respond on click. This goes for all browsers. I found this strange since the only difference is that the MVC bundeling i applied in release mode and as far as I understand it either minifies the jQuery file or chooses the minified version (the latter probably beeing what is does here since it is added when updating using nuget).
The jQuery version is: 2.0.3
The jQuery-ui version is: 1.10.3
In Chrome console the error reads:
Uncaught TypeError: Cannot read property 'safari' of undefined
OK, so i realize this might be the result of one of my jQuery assemblies references $.browser that apparently was removed in jQuery 1.9.
However the fact that it works in debug mode (using the non-minified versions) leads me to think that it might not be that. I could almost think that it is a problem with the minified versions, but that should not be possible either.
Anyone knows why this happens and know how to fix it?
Update
As requested I attach most of the code. The strange thing is that this works in debug mode, but not in release. I cannot see why there would be any significant changes that should cause this problem:
_Layout.cshtml
Bundleconfig.cs
The view (which calls a partial view)
The partial view
The jquery code
The javascript error in Chrome
Bigger view of the error in chrome
Just to add. After posting this I removed the duplicate loading of modernizr (the telerik custom one was added without me noticing). The problem still persists.
Update 2
I turned off the optimizations in bundleconfig.
BundleTable.EnableOptimizations = false;
This allowed me to see what was throwing an error in jquery-ui, and it seems indeed to be the $.browser that was removed. It seems that it actually loads two old versions of jquery (current + 1.6.4 and 1.7.1) together with the new one and two versions of jquery-ui (current + 1.8.16) the last one throwing an error. None of these files are loaded in my solution or in the file folder.
This seems to be a publish problem, but disguised by the bundling and minification... I'll try to fix this and see if it works.
OK, so this was not at all a problem with the code itself, and I learned something new that might be of help to others.
Setting
BundleTable.EnableOptimizations = false;
Was what helped me solve this.
Obviously the Asp.Net MVC 4 bundling bundles every script that is found in the folder where it is released, not what is in the solution folder in Visual Studio. I did not think of this at all... But in retrospect it kind of makes sense.
Combined with the fact that VS default publishing settings does not remove files that does not equal the files that you publish means that when removing i.e. an old version of Jquery and adding a new one, the old one still remains on the server.
Add the default bundling using {version} for jquery selection and you have one unreadable jquery file throwing error. Not until you disable bundling and minification it becomes obvious that I in this circumstance loaded 3 versions of Jquery:
Before
After
The solution? Easy, just have to expand a setting called "File publish options" in the publish wizard and check "Remove additional files...":
Thanks for the suggestions. It helped me look the right places, but I was not able to imagine this beeing the problem.
I think you have forgot to add '"~/Content/themes/base/jquery-ui.all.css"'
Note: although you have called all modules separately sometimes calling single file makes difference. As we might miss some dependent file in choosing separate modules.
In BundleConfig.cs you need to add/modify like..
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery-ui.css",
"~/Content/themes/base/jquery-ui.all.css"
));
if in your locals the file of jQueryUI exist that will do the trick for the same(that might be possible problem that makes it working on Local Testing).
Your _layout.cs will be like..
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/jqueryui")
#Styles.Render("~/Content/themes/base/css")
#RenderSection("scripts", required: false)
as you are not rendering jqueryUI that we need to call and render saperately after jQuery.
And your Section script should be called like this,
#section Scripts{
#*#Scripts.Render("~/bundles/jqueryUI")*#
<script type="text/javascript">
$(document).ready(function () {
$("#accordian").accordian();
});
}
This is what I will suggest and should work, with MVC things are really small to identify exact problem, So I have provided all these lines, thank you,
Do post back if problem persist.