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 7004297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:10:51+00:00 2026-05-27T21:10:51+00:00

I need to output a DIV width into a URL for an iframe but

  • 0

I need to output a DIV width into a URL for an iframe but am having some trouble. I have managed to get java to output the div width, but encounter a problem when getting this into the URL. Below is the code I am using (notice the width=

<iframe src="http://www.coveritlive.com/index2.php/option=com_altcaster/task=viewaltcast/altcast_code=3f43697a78/height=670/width=<script language='javascript'>var e = document.getElementById('Single2');
document.write(e.offsetWidth);</script>"></iframe>

This outputs the URL as:

http://www.coveritlive.com/index2.php/option=com_altcaster/task=viewaltcast/altcast_code=3f43697a78/height=670/width=var e = document.getElementById(‘Single2’);
document.write(e.offsetWidth);

As you can see the URL has the full javascript in, not just it’s output.

Ideally the URL should be as such (lets assume the DIV width is 650px).

http://www.coveritlive.com/index2.php/option=com_altcaster/task=viewaltcast/altcast_code=3f43697a78/height=670/width=650

Any ideas how I can get this working?

  • 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-05-27T21:10:52+00:00Added an answer on May 27, 2026 at 9:10 pm

    You should do this in the following way (pseudo code)

    <iframe id="myIframe"></iframe>
    <script>
    document.getElementById("myIframe").src = ... // construct URL here 
    </script>
    

    Let me know if you need a working example.

    Here is a working example

    <head>
    <script type="text/javascript">
    function changeContent()
    {
        console.log("changing src");
        var myIframe = document.getElementById("guy");
        myIframe.src = "http://steps.mograbi.info/users/sign_in?unauthenticated=true&width=" + myIframe.offsetWidth;
    }
    
    </script>
    </head>
    <body>
    <iframe id="guy"></iframe>
    <script>
    document.onload = changeContent();
    </script>
    </body>
    

    If you track the network, you will see the width passing.. Network as seen in chrome when running my example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to output some JavaScript in a WebControl based on some processing and
Let's say we have 0.33 , we need to output 1/3 . If we
I have a list of objects which need to be output 2 items per
I have a View which is a series of images. I need the output
I need to convert the output of an .aspx page into a JSON object
I need to output the contents of a text field using MS Query Analyzer.
I need to output a file in the format of a Word document from
I'm writing an XSLT template that need to output a valid xml file for
I'm trying to filter webserver log files using grep. I need to output all
My project need to compare output(only urls) of google and yahoo for a particular

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.