JSFiddle - React, Tailwind, and code Playground

HTML

<div data-role="popup" id="externalpage">
    <iframe src="http://www.bbc.com" width="480" height="320" seamless></iframe>
</div>

<a href='#externalpage' data-link="google.com" data-rel="popup" class="getlink" data-role="button">COME HERE</a>

JavaScript

$( document ).on( "pageinit", function() {    	 	     
    $( "#externalpage" ).on({
        popupbeforeposition: function( event, ui ) {  
            console.log( event.target );
        }
    });
});