I’m trying to change the src attribute of an <iframe> depending if the iframe src has  /?foo or not. 
I had this solution:
<script>
    jQuery(document).ready(function($) {
        $('iframe[src*="?foo"]').each(function() {
            $('#frame').attr('src', "http://www.example.com/page2");
        });
    });
</script>
<iframe id="frame" src=„www.example.com/page1/?foo"></iframe>
But my problem is that I have no access to the page, where the iframe is emded so I can't write this code into the <head> of the site.
I have access to both pages www.example.com/page1 and www.example.com/page2
I don’t know how I need to change the code to manipulate the src.. I am not sure if this is even possible, when I have no access to the page with the iframe
 
     
    