I am trying to execute 3 javascript commands on the page http://ringvaart.toervolger.nl/nl/tour_2/livepagina/?mode=default
by loading it into my own div, but I fail to execute the commands. The commands
toggleAllSelected();
setActiveTeamId(64);
toggleSelectedTeamId(40);
are able to execute on the original page, but they are not defined in my own javascript and I therefore am not able to execute them.
Can anyone please help me out?
By the way, due to contraints executing them on the original page is not an option.
Kind regards!
<html>
<body>
<div id="ringvaart"></div>
</body>
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#ringvaart").html( "<object data='http://ringvaart.toervolger.nl/nl/tour_2/livepagina/?mode=default' style='width:100%; padding:0px; margin:0px; height:100%;'/>").ready(
function(){
toggleAllSelected();
setActiveTeamId(64);
toggleSelectedTeamId(40);
}
);
});
</script>
<style >
#ringvaart{
width: 1920px;
}
body{
margin:0px;
padding:0px;
}
</style>
Technically, it is not possible to access inline page of different domain. But if your page and embedded page are in same domain (ringvaart.toervolger.nl), then it is possible. Load the page in iframe
<iframe id="inlinePage" src="http://ringvaart.toervolger.nl/nl/tour_2/livepagina/?mode=default"></iframe>
Then get to the contentWindow of the iframe to access the global variables
document.getElementById('inlinePage').contentWindow
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments