Некоторые расширения ActionLink: http://www.squaredroot.com/post/2008/06/11/MVC-and-SSL.aspx Или атрибут действия контроллера, который перенаправляет к https:// http://forums.asp.net/p/1260198/2358380.aspx#2358380
Вы дождались загрузки iframe?
В любом случае, следующий код работает в FF3.5, Chrome 3, IE6, IE7, IE8.
Размещенная демонстрация: http://jsbin.com/amequ (редактируется через http://jsbin.com/amequ/edit )
<iframe src="blank.htm" ></iframe>
<script>
var $iframe = $('iframe');
/***
In addition to waiting for the parent document to load
we must wait for the document inside the iframe to load as well.
***/
$iframe.load(function(){
var $iframeBody = $iframe.contents().find('body');
alert($iframeBody.height());
/***
IE6 does not like it when you try an insert an element
that is not made in the target context.
Make sure we create the element with the context of
the iframe's document.
***/
var $newDiv = $('<div/>', $iframeBody.get(0).ownerDocument);
$newDiv.css('height', 2000);
$iframeBody.empty().append($newDiv);
alert($iframeBody.height());
});
</script>
Мне пришлось сделать это в недавнем проекте, и я использовал это:
<iframe src="http://domain.com" width="100%"
border="0" frameborder="0" id="newIframe"
onload="$(this).css({height:this.contentWindow ? this.contentWindow.document.body.scrollHeight + (20) : this.contentDocument.body.scrollHeight + (20)});"
style="border:none;overflow:hidden;">
</iframe>
Хотя у меня есть встроенная функция (имеет смысл в моем проекте, поскольку iframe создается с помощью PHP). Если вы добавляете iframe через javascript, это будет что-то вроде
$("#container").append('<iframe src="http://domain.com" width="100%" border="0" frameborder="0" id="newIframe" style="border:none;overflow:hidden;"></iframe>');
$("#newIframe").load(function(){
var _this=$("this")[0];
$(this).css({
height:
_this.contentWindow ? _this.contentWindow.document.body.scrollHeight + (20) : _this.contentDocument.body.scrollHeight + (20)});
});
//contentWindow.document.body is for IE
//contentDocument.body is for everything else
Есть много способов получить доступ к iframe:
Например, у нас есть эта HTML-страница:
<iframe name="my_frame_name" id="my_frame_id">
И JS:
frames[0] == frames['my_frame_name'] == document.getElementById('my_frame_id').contentWindow // true
$('iframe').contents().get(0)
or
$('iframe').contents()[0]
will return the document of the first iframe on the page. Remember jQuery objects are arrays of the matching DOM elements