Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9244099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:56:50+00:00 2026-06-18T08:56:50+00:00

I got an iframe in my page. Like this : <iframe width=600px> <html> <head>

  • 0

I got an iframe in my page. Like this :

<iframe width="600px">
    <html>
        <head>
        </head>
        <body>
            <p>Some text</p>
            <img src="/foo/bar/test.png" />
        </body>
    </html>
</iframe>

I want to be able to detect if the iframe contents is larger than 600px. I tried this one :

var iframe = $('iframe');
if (iframe.width() < iframe.contents().width()) {
    console.log('contents larger than the iframe');
}

It works on Firefox and Internet Explorer. But not on Chrome. On Chrome, iframe.contents().width() is 600.

I tried iframe.contents().find('body').width() but the result is also 600.

How can i detect the iframe contents real width in Chrome ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:56:51+00:00Added an answer on June 18, 2026 at 8:56 am

    I guess you want to get the iframe width of a tinymce iframe.
    You could give this code snippet a try.
    What still needs to be done is to set the caret to the outer right position.
    The idea is to measure the caret location.

    var ed = tinymce.editors[0]; // or tinymce.get('your_editor_id')
    var rng = ed.selection.getRng();
    rng.collapse(true);
    
    var bm = ed.selection.getBookmark();
    var $marker = $(ed.getBody()).find('#'+bm.id);
    var elem = ed.getDoc().getElementById(bm.id+'_start');
    
    try {
        box = elem.getBoundingClientRect();
    } 
        catch(e) 
    {
        console.log('adjustIframePosition (irbasics) error creating box: ' + e);
    }
    
    
    var doc = ed.getDoc(),
        docElem = doc.documentElement,
        body = ed.getBody(),
        win = ed.getWin(),
        clientTop  = docElem.clientTop  || body.clientTop  || 0,
        clientLeft = docElem.clientLeft || body.clientLeft || 0,
        scrollTop  = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop  || body.scrollTop,
        scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
        top  = box.top  + scrollTop  - clientTop,
        left = box.left + scrollLeft - clientLeft;
    
    console.log('iframe width: ' + (box.left + scrollLeft) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a HTML page where it contain an iFrame, within the iFrame I
I've got page to edit some html code from db, to do that I
I've got a chunk of text in an iframe and I'd like to assert
<td width=120 valign=top height=100%> <iframe src=menu.php width=100% height=100% frameborder=0> </iframe> </td> This code always
I got a page like this: ========================================= | PARENT! | | | | |
I got a iframe and I want to select a canvas element in this
I've got a Facebook iframe application that is completely external. By this I mean
Got a question for some jQuery wizard who might stumble upon this. When I
I have a onclick event like this: function OnVisClicked() { $(#overlay).animate({opacity: toggle,width: 3000px,height: 3000px},
I'm uploading some files in the same page using the Iframe technique. I'm extracting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.