Always send nocache_headers() for admin-ajax.php. This prevents iOS from caching ajax calls. http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results

Turn off multi selection uploads for mobile devices. Currently Plupload cannot upload multiple files in iOS Safari. Only the first file makes it to the queue. 

Empty wp on unload to work around caching in iOS Safari.

Props azaozz, miqrogroove, nacin

fixes #22552


git-svn-id: https://develop.svn.wordpress.org/trunk@22872 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-11-27 16:17:53 +00:00
parent 3c3233df00
commit d2d01ad797
4 changed files with 16 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
@header( 'X-Robots-Tag: noindex' );
send_nosniff_header();
nocache_headers();
do_action( 'admin_init' );

View File

@@ -1508,6 +1508,11 @@ $plupload_init = array(
'multipart_params' => $post_params
);
// Multi-file uploading doesn't currently work in iOS Safari,
// single-file allows the built-in camera to be used as source for images
if ( wp_is_mobile() )
$plupload_init['multi_selection'] = false;
$plupload_init = apply_filters( 'plupload_init', $plupload_init );
?>

View File

@@ -809,4 +809,9 @@ window.wp = window.wp || {};
}
});
// Clean up. Prevents mobile browsers caching
$(window).on('unload', function(){
window.wp = null;
});
}(jQuery));

View File

@@ -1254,6 +1254,11 @@ function wp_plupload_default_settings() {
'multipart' => true,
'urlstream_upload' => true,
);
// Multi-file uploading doesn't currently work in iOS Safari,
// single-file allows the built-in camera to be used as source for images
if ( wp_is_mobile() )
$defaults['multi_selection'] = false;
$defaults = apply_filters( 'plupload_default_settings', $defaults );