diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 642f672fafbaaf75863c952d6453c2b5db857139..395467dffb73ab6a45403cd5e88f044729e06156 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1318,6 +1318,9 @@ void LLViewerMediaImpl::loadURI()
 {
 	if(mMediaSource)
 	{
+		// trim whitespace from front and back of URL - fixes EXT-5363
+		LLStringUtil::trim( mMediaURL );
+
 		// *HACK: we don't know if the URI coming in is properly escaped
 		// (the contract doesn't specify whether it is escaped or not.
 		// but LLQtWebKit expects it to be, so we do our best to encode