2

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>

3

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your reply, unfortunately it is not on the same domain and we are not able to take that route.
Use can make use of the Window.postMessage() API if the target website have implement the required functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.