iframe

Detect if browser supports data uri scheme with iframes

你离开我真会死。 提交于 2019-12-18 06:31:26
问题 Internet Explorer does not support the data uri scheme for iframe urls (see http://msdn.microsoft.com/en-us/library/cc848897%28v=vs.85%29.aspx). Other browsers do. As browser detection is loaded with testing and future-proofing problems, I want to use feature detection to work around this issue. So: how can I detect whether or not a browser supports the data uri scheme for iframes? 回答1: This solution by Kevin Martin is tested and seems to be giving the correct result in IE, FF and Chrome:

Passing a PHP Variable in external JS file [duplicate]

泪湿孤枕 提交于 2019-12-18 05:59:11
问题 This question already has answers here : How do I pass variables and data from PHP to JavaScript? (20 answers) Closed 5 years ago . I've read lots of thread on here but I am still unable to get a variable passed from PHP to an external JS file and wondered if someone could assist? In my PHP file I have the following; <script type="text/javascript"> var pass_this_variable = <?php $company['website']; ?>; </script> <script type="text/javascript" src="/js/track.js"></script> In the JS file I

How to get iFrame src content using javascript?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 05:58:23
问题 I have an iFrame, content of which is inside another iFrame. I want to get the inside iFrame's src content. How can I do this using javascript? 回答1: The outer page: <html> <body> <iframe id="ifr1" src="page1.htm"></iframe> <iframe id="ifr2" src="http://www.google.com"></iframe> </body> </html> page1.htm: <html> <body> <script type="text/javascript"> document.write(parent.document.getElementById('ifr2').src); </script> </body> </html> 回答2: iframeInstance.contentWindow.document - this document

How to get iFrame src content using javascript?

走远了吗. 提交于 2019-12-18 05:58:07
问题 I have an iFrame, content of which is inside another iFrame. I want to get the inside iFrame's src content. How can I do this using javascript? 回答1: The outer page: <html> <body> <iframe id="ifr1" src="page1.htm"></iframe> <iframe id="ifr2" src="http://www.google.com"></iframe> </body> </html> page1.htm: <html> <body> <script type="text/javascript"> document.write(parent.document.getElementById('ifr2').src); </script> </body> </html> 回答2: iframeInstance.contentWindow.document - this document

line after IFRAME is not visible

不问归期 提交于 2019-12-18 05:43:47
问题 line after IFRAME is not visible in both IE and FF. refer the below code and let me know whether I am doing anything wrong. <html> <body> line before iframe <br /> <iframe src="about:blank" /> <br /> line after iframe </body> </html> 回答1: you need to close the iframe tag. otherwise the content that comes after it is considered "things to show" when iframe is not supported. (by the way, i think if you use XHTML to write the <iframe ... /> then IE will take it as HTML instead. IE doesn't

to fit iframe to its content height

会有一股神秘感。 提交于 2019-12-18 05:22:29
问题 <script language="JavaScript"> function autoResize(id){ alert('check'); var newheight; var newwidth; if(document.getElementById){ newheight=document.getElementById(id).contentWindow.document .body.scrollHeight; newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth; } alert(newheight); alert(newwidth); document.getElementById(id).height= (newheight) + "px"; document.getElementById(id).width= (newwidth) + "px"; } </script> HTML: <iframe id="faq_iframe" src="http://www

to fit iframe to its content height

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 05:21:40
问题 <script language="JavaScript"> function autoResize(id){ alert('check'); var newheight; var newwidth; if(document.getElementById){ newheight=document.getElementById(id).contentWindow.document .body.scrollHeight; newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth; } alert(newheight); alert(newwidth); document.getElementById(id).height= (newheight) + "px"; document.getElementById(id).width= (newwidth) + "px"; } </script> HTML: <iframe id="faq_iframe" src="http://www

How to detect click event in iframe using jquery

喜你入骨 提交于 2019-12-18 05:15:07
问题 This is my iframe: #htmlDiv { position: absolute; top: 0px; left: 300px; height: 650px; width: 1130px; } #htmlFrame { position: absolute; top: 0px; left: 0px; margin: 10px 10px 10px 10px; padding: 0px 0px 0px 0px; height: 630px; width: 1110px; } <div id="htmlDiv"> <iframe id="htmlFrame"></iframe> </div> $('#htmlFrame').click(function(){ alert('clicked'); }); But when I click inside the iframe, it doesn't show "clicked". How do I detect click inside iframe. 回答1: You cannot detect a click event

jQuery iframe scroll event (IE)

让人想犯罪 __ 提交于 2019-12-18 04:57:08
问题 Can't listen to the scroll event in Internet Explorer 7. I've tried: $("#myIframe").scroll(function() { alert('hi'); }) Works for FF: $($("#myIframe").contents().get(0)).scroll(function() { alert('hi'); }) Getting keypresses work: $($("#myIframe").contents().get(0)).keydown(function() { alert('hi'); }) 回答1: As much as I love jQuery. I can't get this to work. However, I tried this in plain old javascript and it worked just fine in IE, FF,Safari and Chrome. <script type="text/javascript">

Is it possible to disable right click on an iframe?

北城以北 提交于 2019-12-18 04:23:17
问题 Is it possible to disable right click on an iframe? I know it might be possible if the file in the iframe resides in the same domain,but i was wondering if it could be done if the file in the frame was from an external site? thanks 回答1: You can't really disable the context menu to begin with. You can only construct fragile barricades to keep people from invoking it. But the fact that this is an external iframe only compounds the issue. No, you can't keep the users from activating the context