Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have an aspx page and in that i have an iframe for displaying another page, so i want to make that iframe to fit to the window height and width. i tried all and i couldn't find the appropraite solution so can anyone please help me..

Thanks in advance
Posted
Updated 9-Nov-14 20:23pm
v2
Comments
Kornfeld Eliyahu Peter 10-Nov-14 2:26am    
And what should happen to other parts of the page - around the iframe?
Karthik Bilakanti 10-Nov-14 3:54am    
other parts of the page should be hided
Kornfeld Eliyahu Peter 10-Nov-14 4:06am    
In that case why open in iframe - open a new page!!!
Karthik Bilakanti 10-Nov-14 4:07am    
Actually i used pixcels for width and height, so what happened is when we are viewing the aspx page in localmachine its working fine, but when we deploy the same aspx page to some other server i am getting scroll bar. so my challenge is when i deploy the same aspx page in any server i shouldn't get any scroll bar. Please help me .....
Mukesh Pr@sad 10-Nov-14 2:32am    
are u using like following??
<iframe id="iframe1" runat="server" scrolling="no" width="600px" height="400px" src=""></iframe>

Karthik,

you need to use RESPONSIVE iFrame. hope this will help you to resolve. please read
 
Share this answer
 
Hi,

Refer the Following link and it may helpful to you ...

http://davidjbradshaw.github.io/iframe-resizer/[^]

It automatically re size the iframe even the iframe contents changed dynamically..

Thanks,
Magesh M
 
Share this answer
 
Hi Karthik,

          After googling I got this solution and it is working fine for every browser.
..


ASP.NET
<blockquote class="quote"><div class="op">Quote:</div><![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>]]>



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
/** This is high-level function.
 * It must react to delta being more/less than zero.
 */
function handle(delta) {
var d=delta*-10;
window.scrollBy(0,d);
}

/** Event handler for mouse wheel event.
 */
function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        if (delta)
                handle(delta);
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        if (event.preventDefault)
                event.preventDefault();
	event.returnValue = false;
}

/** Initialization code. 
 * If you use your own event management code, change it as required.
 */
if (window.addEventListener)
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
 <iframe width="300" height="300" scrolling="no" frameborder="1" src="http://www.w3schools.com"></iframe>
    </div>
    </form>
</body>
</html></blockquote>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900