WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#18952 closed defect (bug) (fixed)

AJAX calls to IDN don't work in IE and Opera

Reported by: SergeyBiryukov Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.2.1
Component: I18N Keywords: has-patch dev-feedback
Focuses: Cc:

Description

In jQuery 1.5+, AJAX requests on sites with IDN domains don't work in IE 8 or 9.

On Edit Post screen, adding a new category results in JS error:

Message: 'parsed.responses' - is null or not an object
Line: 311
Char: 4
Code: 0
URI: http://домен.рф/wp-admin/js/post.dev.js?ver=20110524

On Categories screen, adding a new category silently fails.

According to jaubourg's comment in jQuery bug tracker, the request is considered cross-domain and, since IE doesn't support cross-domain requests, AJAX won't find a suitable transport and bail out. The ticket only refers to IE 8, but I've checked this in IE 9, and it seems to show the same behaviour.

A workaround suggested there is to use unencoded domain name or strip it completely.

Attachments (6)

idn-ajax-workaround.php (499 bytes) - added by SergeyBiryukov 4 years ago.
18952.patch (6.1 KB) - added by SergeyBiryukov 4 years ago.
18952.2.patch (1.5 KB) - added by SergeyBiryukov 4 years ago.
18952.3.patch (5.7 KB) - added by SergeyBiryukov 3 years ago.
18952.4.patch (8.2 KB) - added by SergeyBiryukov 3 years ago.
18952.5.patch (11.0 KB) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 @SergeyBiryukov4 years ago

Attached a workaround plugin.

comment:2 @SergeyBiryukov4 years ago

  • Summary changed from AJAX calls to IDN don't work in IE to AJAX calls to IDN don't work in IE and Opera

Opera 11.51 is also affected.

@SergeyBiryukov4 years ago

@SergeyBiryukov4 years ago

comment:3 @SergeyBiryukov4 years ago

  • Keywords has-patch added

18952.patch and 18952.2.patch are two different attempts to use a relative admin URL for AJAX requests.

comment:5 @SergeyBiryukov4 years ago

  • Milestone changed from Awaiting Review to 3.4

comment:6 @SergeyBiryukov4 years ago

Well, relative_admin_url() from 18952.patch obviously doesn't need $scheme parameter.

comment:7 @SergeyBiryukov3 years ago

  • Component changed from External Libraries to I18N
  • Keywords dev-feedback added

comment:8 follow-up: @nacin3 years ago

Perhaps this should be wp_ajax_url() instead of a wrapper, as we probably wouldn't use it elsewhere.

@SergeyBiryukov3 years ago

comment:9 in reply to: ↑ 8 @SergeyBiryukov3 years ago

Replying to nacin:

Perhaps this should be wp_ajax_url() instead of a wrapper, as we probably wouldn't use it elsewhere.

Thanks, done in 18952.3.patch.

comment:10 follow-up: @ryan3 years ago

I was thinking all of the url functions that accept a scheme argument could accept relative and root_relative, or the like. No new function needed except unless we want a convenience wrapper or filters with more specific context.

Version 0, edited 3 years ago by ryan (next)

@SergeyBiryukov3 years ago

@SergeyBiryukov3 years ago

comment:11 in reply to: ↑ 10 @SergeyBiryukov3 years ago

Replying to ryan:

I was thinking all of the url functions that accept a scheme argument could accept relative and root_relative, or the like.

Makes sense, done in 18952.4.patch. 18952.5.patch also updates PHPDocs.

comment:12 @nacin3 years ago

In [19870]:

Introduce 'relative' scheme to return only the paths for home_url, site, admin, network_, and get_ variants. props SergeyBiryukov, see #18952.

comment:13 @nacin3 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [19871]:

Use relative paths for admin-ajax.php to avoid cross-domain issues with IDN domains in IE and Opera. props SergeyBiryukov, fixes #18952.

comment:14 @nacin3 years ago

In [20188]:

URL to admin-ajax.php should be relative. see #19910. see #18952.

comment:15 @nacin3 years ago

In [20191]:

Use ajaxurl rather than direct references to admin-ajax.php. see #18952.

Note: See TracTickets for help on using tickets.