Ayon Sikder
Ayon Sikder

Reputation: 13

javascript jquery, web development

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> 

Upvotes: 0

Views: 69

Answers (1)

ALFmachine
ALFmachine

Reputation: 808

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/'); 

Upvotes: 1

Related Questions