WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 17 months ago

Last modified 15 months ago

#18952 closed defect (bug) (fixed)

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

Reported by: SergeyBiryukov Owned by: nacin
Priority: normal Milestone: 3.4
Component: I18N Version: 3.2.1
Severity: normal Keywords: has-patch dev-feedback
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 20 months ago.
18952.patch (6.1 KB) - added by SergeyBiryukov 20 months ago.
18952.2.patch (1.5 KB) - added by SergeyBiryukov 20 months ago.
18952.3.patch (5.7 KB) - added by SergeyBiryukov 17 months ago.
18952.4.patch (8.2 KB) - added by SergeyBiryukov 17 months ago.
18952.5.patch (11.0 KB) - added by SergeyBiryukov 17 months ago.

Download all attachments as: .zip

Change History (21)

comment:1 SergeyBiryukov20 months ago

Attached a workaround plugin.

comment:2 SergeyBiryukov20 months 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.

SergeyBiryukov20 months ago

SergeyBiryukov20 months ago

comment:3 SergeyBiryukov20 months 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 SergeyBiryukov18 months ago

  • Milestone changed from Awaiting Review to 3.4

comment:6 SergeyBiryukov17 months ago

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

comment:7 SergeyBiryukov17 months ago

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

comment:8 follow-up: nacin17 months ago

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

SergeyBiryukov17 months ago

comment:9 in reply to: ↑ 8 SergeyBiryukov17 months 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: ryan17 months 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 unless we want a convenience wrapper or filters with more specific context.

Last edited 17 months ago by ryan (previous) (diff)

SergeyBiryukov17 months ago

SergeyBiryukov17 months ago

comment:11 in reply to: ↑ 10 SergeyBiryukov17 months 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 nacin17 months 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 nacin17 months 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 nacin15 months ago

In [20188]:

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

comment:15 nacin15 months ago

In [20191]:

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

Note: See TracTickets for help on using tickets.