diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp
index 7a544debb2b94cd811804e61250d0f05db125383..166905c37cfb8e710d6d0a6bdf79ab0fd91d7127 100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.cpp
+++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp
@@ -959,6 +959,23 @@ mediaPanel*  LLMediaPluginTest::findMediaPanel( LLPluginClassMedia* source )
 	return result;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+//
+mediaPanel* LLMediaPluginTest::findMediaPanel( const std::string &target_name )
+{
+	mediaPanel *result = NULL;
+
+	for( int panel = 0; panel < (int)mMediaPanels.size(); ++panel )
+	{
+		if ( mMediaPanels[ panel ]->mTarget == target_name )
+		{
+			result = mMediaPanels[ panel ];
+		}
+	}
+
+	return result;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 void LLMediaPluginTest::navigateToNewURI( std::string uri )
@@ -1571,7 +1588,7 @@ std::string LLMediaPluginTest::pluginNameFromMimeType( std::string& mime_type )
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-void LLMediaPluginTest::addMediaPanel( std::string url )
+mediaPanel* LLMediaPluginTest::addMediaPanel( std::string url )
 {
 	// Get the plugin filename using the URL
 	std::string mime_type = mimeTypeFromUrl( url );
@@ -1603,7 +1620,7 @@ void LLMediaPluginTest::addMediaPanel( std::string url )
 	if (NULL == getcwd( cwd, FILENAME_MAX - 1 ))
 	{
 		std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl;
-		return;
+		return NULL;
 	}
 	std::string user_data_path = std::string( cwd ) + "/";
 #endif
@@ -1673,6 +1690,8 @@ void LLMediaPluginTest::addMediaPanel( std::string url )
 
 		std::cout << "Adding new media panel for " << url << "(" << media_width << "x" << media_height << ") with index " << panel->mId << " - total panels = " << mMediaPanels.size() << std::endl;
 	}
+	
+	return panel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1778,15 +1797,15 @@ void LLMediaPluginTest::updateMediaPanel( mediaPanel* panel )
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
+mediaPanel* LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
 {
 	// no media panels so we can't change anything - have to add
 	if ( mMediaPanels.size() == 0 )
-		return;
+		return NULL;
 
 	// sanity check
 	if ( ! panel )
-		return;
+		return NULL;
 
 	int index;
 	for(index = 0; index < (int)mMediaPanels.size(); index++)
@@ -1798,7 +1817,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
 	if(index >= (int)mMediaPanels.size())
 	{
 		// panel isn't in mMediaPanels
-		return;
+		return NULL;
 	}
 
 	std::cout << "Replacing media panel with index " << panel->mId << std::endl;
@@ -1840,7 +1859,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
 	if (NULL == getcwd( cwd, FILENAME_MAX - 1 ))
 	{
 		std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl;
-		return;
+		return NULL;
 	}
 	std::string user_data_path = std::string( cwd ) + "/";
 #endif
@@ -1880,6 +1899,8 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
 	// load and start the URL
 	panel->mMediaSource->loadURI( url );
 	panel->mMediaSource->start();
+	
+	return panel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -2139,7 +2160,46 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
 		break;
 
 		case MEDIA_EVENT_CLICK_LINK_HREF:
-			std::cerr <<  "Media event:  MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << std::endl;
+		{
+			std::cerr <<  "Media event:  MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << ", target is " << self->getClickTarget() << std::endl;
+			// retrieve the event parameters
+			std::string url = self->getClickURL();
+			std::string target = self->getClickTarget();
+			U32 target_type = self->getClickTargetType();
+
+			switch (target_type)
+			{
+				case LLPluginClassMedia::TARGET_NONE:
+					// ignore this click
+				break;
+				
+				case LLPluginClassMedia::TARGET_EXTERNAL:
+					// this should open in an external browser, but since this is a test app we don't care.
+				break;
+				
+				case LLPluginClassMedia::TARGET_BLANK:
+					// Create a new panel with the specified URL.
+					addMediaPanel(url);
+				break;
+
+				case LLPluginClassMedia::TARGET_OTHER:
+					mediaPanel *target_panel = findMediaPanel(target);
+					if(target_panel)
+					{
+						target_panel = replaceMediaPanel(target_panel, url);
+					}
+					else
+					{
+						target_panel = addMediaPanel(url);
+					}
+
+					if(target_panel)
+					{
+						target_panel->mTarget = target;
+					}
+				break;
+			}
+		}
 		break;
 
 		case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.h b/indra/test_apps/llplugintest/llmediaplugintest.h
index 5d08e4214891dc8e6bb88cb9ad924f7ad8269b46..ecd6cbfc4ff0575d7e147f272bd6d9b9666f8e1e 100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.h
+++ b/indra/test_apps/llplugintest/llmediaplugintest.h
@@ -56,6 +56,7 @@ struct mediaPanel
 		int mId;
 		std::string mStartUrl;
 		std::string mMimeType;
+		std::string mTarget;
 		LLPluginClassMedia *mMediaSource;
 		int mMediaWidth;
 		int mMediaHeight;
@@ -96,16 +97,17 @@ class LLMediaPluginTest : public LLPluginClassMediaOwner
 		void draw( int draw_type );
 		void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id );
 
-		void addMediaPanel( std::string url );
+		mediaPanel* addMediaPanel( std::string url );
 		void updateMediaPanel( mediaPanel* panel );
 		void remMediaPanel( mediaPanel* panel );
-		void replaceMediaPanel( mediaPanel* panel, std::string url );
+		mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url );
 		void getRandomMediaSize( int& width, int& height, std::string mime_type );
 		void navigateToNewURI( std::string uri );
         void initUrlHistory( std::string uri );
 		void selectPanelById( int id );
 		void selectPanel( mediaPanel* panel );
 		mediaPanel* findMediaPanel( LLPluginClassMedia* panel );
+		mediaPanel* findMediaPanel( const std::string &target_name );
 		void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels );
 		void makeChrome();
 		void resetView();