0

I'm using iframe to load lumextech.com as default src in a frame when i search and move to other webpage using lumextech.com But still in the iframe src its display lumextech.com only i wanted to capture url of page that has loaded in iframe...Notes: I don't have Control on lumextech.com....

My Code:

<! DOCTYPE html>

<html>
    <head>
    <script type="text/javascript" src="jquery.min.js"></script>
    </head>

    <body>
                <section>
                    <h3> welcome to Iframe</h3>                      

                    <script type="text/javascript">


                        $(function(){
                            $('#submit').click(function(){
                               $url = $('#iframeContent').attr('src');
                               $('#demo').html($url);                               
                            });
                        });


                    </script>

                    <input type="submit" id="submit" value="showUrl"/> 
                    <div id="demo"></div> 

                    <iframe id="iframeContent" src="http://lumextech.com" style="min-height: 500px; min-width: 500px;"></iframe>               


                </section>
    </body>

</html> 
2
  • Same origin policy restrictions prevents such access to a iframe Commented Nov 2, 2015 at 5:20
  • There should be a way........!!!!!!!! Commented Nov 2, 2015 at 5:52

1 Answer 1

1

You had a typo in your src insert function. Extra white space in the string. Work good on this Codepen

$('#frameid').attr('src', 'http://lumextech.com/'); 
Sign up to request clarification or add additional context in comments.

5 Comments

Ok, i remove the space but what about the main problem...... how can i get the current url........
There should... gimme sec
Yeah my bad looks like no go. Good luck
contentWindow.location.herf works only if the iframe is in the same domain but i'm working wit different domain... I think it's not possible ........ Browser will not give that permission.............

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.