Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - How can I dynamically resize my iframe, avoiding the browser security crossdomain restrictions? -


we have embeddable badge creates iframe. needs dynamic size; changes size based on data loaded 3rd party api or our database. it's not known height before loads.

it's invoked tag loads script our server, creates iframe set specific src.

on own machine, within iframe can do

window.parent.document.getelementbyid('my_frame').style.height=new_calculated_height+'px'; 

but of course when it's embedded in page different iframe src, fails due crossdomain restrictions ('unsafe access attempt' error in ff, etc.).

as we're loading script host page full access, kind of silly.

basically, need variable, new height, iframe host page.

could in reverse maybe? have function on host page ask iframe it's element's offsetheight?

this can real pain in butt working cross browser.

i suggest use easyxdm (http://easyxdm.net/). it's javascript library uses postmessage transport on modern browsers , uses javascript ninja on old browsers.

the library allows communicate between iframe , it's parent if aren't on same domain.

the library supports way down ie6!

edit: there's example resize height of iframe dynamically once content loaded: http://easyxdm.net/wp/2010/03/17/resize-iframe-based-on-content/

  • christian

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -