- url += ( url.indexOf( '?' ) !== -1 ? '&' : '?' ) +
- // Depending on server configuration, MediaWiki may forbid periods in URLs, due to an IE 6
- // XSS bug. So let's escape them here. See WebRequest::checkUrlExtension() and T30235.
- 'origin=' + encodeURIComponent( origin ).replace( /\./g, '%2E' );
+ if ( origin !== undefined ) {
+ url += ( url.indexOf( '?' ) !== -1 ? '&' : '?' ) +
+ // Depending on server configuration, MediaWiki may forbid periods in URLs, due to an IE 6
+ // XSS bug. So let's escape them here. See WebRequest::checkUrlExtension() and T30235.
+ 'origin=' + encodeURIComponent( origin ).replace( /\./g, '%2E' );
+ }