dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: get src of element on Mouseover in iframes

Hybrid View

  1. #1
    Join Date
    Apr 2013
    Location
    Bangalore
    Posts
    2

    get src of element on Mouseover in iframes

    Hi All,

    I am developing an app wherer I am loading websites in iframe. & on mouseover on that site/iframe anywhere, it should give me the src of an element on which mouse over is done...

    I am writing a jquery as,

    //on HTML Mouse over
    $(function() {
    $("#main_frame").mouseover(function() {
    prevElement = null;
    curElement = window.event.srcElement.tagName;
    window.status = curElement;
    });
    });

    & HTML Part where the URL will be loaded is
    <div id="netframe">
    <iframe height="100%" width="100%" class="netframe" src="#" id="main_frame" name="content">
    </iframe>
    </div>

    But thi sis not working, it gives a me src of only iframe, but not of its content site.
    Please help.
    Regards
    Shweta

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    you would need to add the event handler in the framed site, not the framing site.

  3. #3
    Join Date
    Apr 2013
    Location
    Bangalore
    Posts
    2
    How can we do that? Cause the target loading site can be anything....
    As well, when I am trying to do something like this,

    var collAll = document.frames("main_frame").document.all;
    alert(collAll);

    Its giving me Access denied error.
    Please help.
    Reagrds
    Shweta

  4. #4
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    Quote Originally Posted by ShwetaA View Post
    How can we do that? Cause the target loading site can be anything....
    no, it cannot. it has to be a document you created and published.

    javascript won't allow you to manipulate or even read documents on other domains, with a few opt-in exceptions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles