• Hi.

    Depending on the situation or the browser, a “$.wpcf7SupportHtml5 is not a function” error is triggered in includes/js/scripts.js (yes, jQuery is loaded before).

    Fix: move this part at the end of the file, rather than the beginning:

    $(function() {
    	_wpcf7.supportHtml5 = $.wpcf7SupportHtml5();
    	$('div.wpcf7 > form').wpcf7InitForm();
    });

    Thanks.
    Greg

    https://wordpress.org/plugins/contact-form-7/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Grégory Viguier

    (@greglone)

    Hu, resolved? Did I unintentionally do that, or did @takayuki Miyoshi passed by?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Sorry, I thought you have fixed it by yourself.

    Normally such issues aren’t seen. Try switching to the default theme and deactivating all other plugins to rule out cases of other theme/plugin interfering.

    Thread Starter Grégory Viguier

    (@greglone)

    Hi.

    The problem doesn’t come from a third party plugin or the theme. Well, ok, kind of.
    I try to defer my JavaScript files by using the library LABjs. But on certain circumstances I have an error.

    I made some more tests, and for example on my contact page, the error seems to occur with IE8/9/10 (not in IE11, nor Firefox/Chrome/Safari, not tested with IE6/7): you’ll have the error message “Object doesn’t support property or method ‘wpcf7SupportHtml5′” in your console.
    I admit I’m not sure if the problem is caused by the library itself, because your script is deferred, or simply because… IE.

    Basically, what you do in your script:

    _wpcf7.wpcf7SupportHtml5 = $.wpcf7SupportHtml5();
    
    $.wpcf7SupportHtml5 = function() {
        // whatever
    };

    To fix this problem is as simple as a cut/paste. Simply cut the following code from the beginning of your file:

    $(function() {
    	_wpcf7.supportHtml5 = $.wpcf7SupportHtml5();
    	$('div.wpcf7 > form').wpcf7InitForm();
    });

    and paste it at the end of the file, after $.wpcf7SupportHtml5 = function() { /*...*/ }. I gave it a try and the problem was gone.

    I agree this problem should not occur under normal circumstances since the file should be parsed first by the browser, then executed, and I don’t know why old versions of IE throw this error. Yeah, I know, “old versions of IE”, I guess we should not expect too much >_>

    So, could you please fix this?
    Thank you.

    PS: a minified version of this script would be great 🙂

    Where can I up-vote this solution?
    🙂

    Hi
    Thank you very much for sharing.
    Works very well. No more error in ie8.
    regards
    theo

    I am getting unexpected token > error. How Can i resolve this? I am getting this error on includes/js/scripts.js

    var e = $(‘<div class=”ajax-error”></div>’).text(error.message);

    Can any one help me? please..

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Javascript error’ is closed to new replies.