iframe

Ruby on rails 4 app does not work in iframe

半城伤御伤魂 提交于 2019-12-17 10:18:55
问题 How can I embed my rails app into another website via iframe? It works nicely with RoR 3, but not with RoR 4: <iframe src="http://myrailsapp.com/" width="100%" height="50" id="rails_iframe">error!</iframe> I tried to use verify_authenticity_token and protect_from_forgery options in my controller... seems it's something else (but I'm not sure). upd. Example: http://jsfiddle.net/zP329/ 回答1: This has to do with Rails 4 enabling additional security protocols by default: http://weblog.rubyonrails

What's the best way to set cursor/caret position?

眉间皱痕 提交于 2019-12-17 10:17:23
问题 If I'm inserting content into a textarea that TinyMCE has co-opted, what's the best way to set the position of the cursor/caret? I'm using tinyMCE.execCommand("mceInsertRawHTML", false, content); to insert the content, and I'd like set the cursor position to the end of the content. Both document.selection and myField.selectionStart won't work for this, and I feel as though this is going to be supported by TinyMCE (through something I can't find on their forum) or it's going to be a really

Can a button click cause an event in iframe?

爷,独闯天下 提交于 2019-12-17 10:05:40
问题 Let's say I have a button right next to an Iframe and in that Iframe is a download link. Is it possible that when I click the outside button, the download link on the iframe will be clicked? http://jsfiddle.net/idude/9RQ3N/ <button type="button">Click Me!</button> <iframe src="http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_download" height="400" width="800"> For example, in the jsfiddle link above, how could I make it so that the w3 picture would be downloaded by just clicking

Can javascript running inside an iframe affect the main page?

时间秒杀一切 提交于 2019-12-17 10:00:03
问题 Partial Code: My below code pulls a query from my DB and then uses inner.HTML = to display the data inside a div. It works fine in it original use.... However the below version is called inside a iFrame as it is used to update the page. The page has no errors and the JavaScript fires however the last line does not work... I have just realized that perhaps since it is loading in the hidden iFrame it is trying to set the innerHTML of a div inside the iFrame and that of course will not work. Is

Stopping a iframe from loading a page using javascript

与世无争的帅哥 提交于 2019-12-17 09:39:53
问题 Is there a way in javascript of stopping an iframe in the middle of loading a page? The reason I need to do this is I have a background iframe streaming data from a web server (via a Comet style mechanism) and I need to be able to sever the connection at will. Any ideas welcome. 回答1: For FireFox/Safari/Chrome you can use window.stop(): window.frames[0].stop() For IE, you can do the same thing with document.execCommand('Stop'): window.frames[0].document.execCommand('Stop') For a cross-browser

JS实现点击下载

大城市里の小女人 提交于 2019-12-17 08:43:30
JS实现点击下载 作者: 罗刚 文章来源:本站原创 点击数: 790 更新时间:2010-7-20 下面告诉大家一个可以通过点击实现图片或者其他文件下载的JS 在模板中加入以下代码: <a href="xx.xx" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载</a> <script> function savepic() { if(document.all.a1==null) { objIframe=document.createElement("IFRAME"); document.body.insertBefore(objIframe); objIframe.outerHTML= "<iframe name=a1 style='width:0;hieght:0' src="+pic1.href+"></iframe>"; re=setTimeout("savepic()",1) } else { clearTimeout(re) pic = window.open(pic1.href,"a1") pic.document.execCommand("SaveAs") document.all.a1.removeNode(true) } } </script> 注: href="xx.xx"

Getting youtube.com to load in iFrame

自闭症网瘾萝莉.ら 提交于 2019-12-17 07:43:06
问题 Can't get Youtube's homepage, or any other youtube.com prefixed URL to load in an iFrame. Any suggestions or insights? Code: <iframe src="http://youtube.com" frameborder="0" width="1020" height="560" horizontalscrolling="no" verticalscrolling="yes"></iframe> 回答1: Youtube does not allow embedding. Only http://www.youtube.com/embed/* is allowed, which is for HTML5 videos. 回答2: youtube.com cannot be loaded in an iframe. A possible duplicate: See this 来源: https://stackoverflow.com/questions

Wait for iframe to load in JavaScript

本小妞迷上赌 提交于 2019-12-17 07:31:20
问题 I am opening an iframe in JavaScript: righttop.location = "timesheet_notes.php"; and then want to pass information to it: righttop.document.notesform.ID_client.value = Client; Obviously though, that line isn't going to work until the page has fully loaded in the iframe, and that form element is there to be written to. So, what is the best/most efficient way to address this? Some sort of timeout loop? Ideally I would really like to keep it all contained within this particular script, rather

Wait for iframe to load in JavaScript

偶尔善良 提交于 2019-12-17 07:31:09
问题 I am opening an iframe in JavaScript: righttop.location = "timesheet_notes.php"; and then want to pass information to it: righttop.document.notesform.ID_client.value = Client; Obviously though, that line isn't going to work until the page has fully loaded in the iframe, and that form element is there to be written to. So, what is the best/most efficient way to address this? Some sort of timeout loop? Ideally I would really like to keep it all contained within this particular script, rather

Close jQuery UI Dialog from Iframe

时光总嘲笑我的痴心妄想 提交于 2019-12-17 07:24:45
问题 I've implemented the following code for uploading photos inside a jQuery dialog (using an iframe). Here's the Iframe <div style="display: none"> <iframe id="upload-form" frameborder="0" marginheight="0" marginwidth="0" src="Upload.aspx"></iframe> </div> And here's the jQuery code on the parent page which takes care of opening the dialog. $("#upload-image").click(function (e) { e.preventDefault(); $('#upload-form').dialog({ modal: true, width: 300, title: "Upload Image", autoOpen: true, close: