473,694 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using iframes in Safari

I am trying to access image information that is displayed using
iframe.
iframe code looks like this:
<iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
frameborder="0" style="border: 0; width: 280px; height: 455px;"></
iframe>

I need to figure out height of the image.

In Firefox and IE it is not a problem.

document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
[0].height
document.getEle mentById('testI mage').contentW indow.contentDo cument.height

But in Safari contentWindow is undefined.

Mar 16 '07 #1
5 14778
On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
I am trying to access image information that is displayed using
iframe.
iframe code looks like this:
<iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
frameborder="0" style="border: 0; width: 280px; height: 455px;"></
iframe>

I need to figure out height of the image.

In Firefox and IE it is not a problem.

document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
[0].height
document.getEle mentById('testI mage').contentW indow.contentDo cument.height

But in Safari contentWindow is undefined.
contentWindow is an MS proprietary property of frame and iframe
elements, it may not be supported by browsers other than IE so make
sure you test for it before attempting to use it.
--
Rob

Mar 17 '07 #2
I was able to use it in Firefox. But my problem is Safari.

On Mar 17, 12:08 am, "RobG" <r...@iinet.net .auwrote:
On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
I am trying to access image information that is displayed using
iframe.
iframe code looks like this:
<iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
frameborder="0" style="border: 0; width: 280px; height: 455px;"></
iframe>
I need to figure out height of the image.
In Firefox and IE it is not a problem.
document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
[0].height
document.getEle mentById('testI mage').contentW indow.contentDo cument.height
But in Safari contentWindow is undefined.

contentWindow is an MS proprietary property of frame and iframe
elements, it may not be supported by browsers other than IE so make
sure you test for it before attempting to use it.

--
Rob

Mar 17 '07 #3
"RobG" <rg***@iinet.ne t.auwrote in message
news:11******** *************@n 76g2000hsh.goog legroups.com...
On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
>I am trying to access image information that is displayed using
iframe.
iframe code looks like this:
<iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
frameborder="0 " style="border: 0; width: 280px; height: 455px;"></
iframe>

I need to figure out height of the image.

In Firefox and IE it is not a problem.

document.getEl ementById('test Image').content Window.document .getElementsByT a
gName('img')
[0].height
document.getEl ementById('test Image').content Window.contentD ocument.height

But in Safari contentWindow is undefined.

contentWindow is an MS proprietary property of frame and iframe
elements, it may not be supported by browsers other than IE so make
sure you test for it before attempting to use it.
Sure would be nice if the older pages at Mozilla could get a little update. I remember it
losing out in Mozilla, but cannot find where I read it.

The original poster can use document.defaul tView instead of contentWindow.

-Lost
Mar 17 '07 #4
"-Lost" <mi*********@co mcast.netwrote in message
news:9Y******** *************** *******@comcast .com...
"RobG" <rg***@iinet.ne t.auwrote in message
news:11******** *************@n 76g2000hsh.goog legroups.com...
>On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
>>I am trying to access image information that is displayed using
iframe.
iframe code looks like this:
<iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
frameborder=" 0" style="border: 0; width: 280px; height: 455px;"></
iframe>

I need to figure out height of the image.

In Firefox and IE it is not a problem.

document.getE lementById('tes tImage').conten tWindow.documen t.getElementsBy Ta
gName('img' )
[0].height
document.getE lementById('tes tImage').conten tWindow.content Document.height

But in Safari contentWindow is undefined.

contentWindo w is an MS proprietary property of frame and iframe
elements, it may not be supported by browsers other than IE so make
sure you test for it before attempting to use it.

Sure would be nice if the older pages at Mozilla could get a little update. I remember
it losing out in Mozilla, but cannot find where I read it.

The original poster can use document.defaul tView instead of contentWindow.
Oops, scratch that. I know diddly about Safari, so no clue if what I suggested is an
alternative or not.

-Lost
Mar 17 '07 #5
ASM
lu************@ yahoo.com a écrit :
I was able to use it in Firefox. But my problem is Safari.
with Safari the document of iframe is empty ... !
(for sure ! ! ! :-( )

Little test (in old JS) :

<html>
<iframe id="testImage" name="testImage " src="test.gif" scrolling="yes"
frameborder="0" style="border: 0; width: 580px; height: 455px;">
</iframe>

<form onsubmit="retur n false;">
<p>Works with : FF 2, Opera 9, iCab 3.0.3 :
<button onclick="
if(parent.testI mage.document.i mages)
alert(parent.te stImage.documen t.images.length >0);
">is there an image ? </button>
</p>
<p>Works with : FF 2, Opera 9, iCab 3.0.3 :
<button onclick="
if(parent.testI mage.document.i mages)
alert(parent.te stImage.documen t.images[0].height);">heig ht </button>
</p>
<p>Works with : FF 2 *AND* Safari 1.3<br>
but *NOT* with Opera 9 and iCab 3.0.3, :
<button onclick="
var I = new Image();
I.src = parent.testImag e.location;
alert(I.height) ;
">height </button>
</p>
</form>
</html>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3926
by: maxim vexler | last post by:
I'm reading a lot of talks lately about the term iFrame and with your permission would like to ask a few question about that : - what is iFrame, i mean what is it good for ? - does all the popular browsers support it (mostly mozilla & the much hated IE, google says the do but nothing is better that experienced answer) - iFrames replaces the old frames once used in html to show a number of pages in a single windows, right ? - what are...
0
2091
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4 IFRAMES and 2 IMGs tags. The problem is that the second IFRAME from the second page generates fires a new session.
5
2450
by: Foreman | last post by:
Using ASPFileUpload (http://support.microsoft.com/default.aspx?scid=kb;en-us;299692) and works for IE6 and FireFox but not Safari. Thanks in advance for your assistance.
4
6453
by: libsfan01 | last post by:
hey this code wont work for my iframe in safari, i cant change the page by changing the src with js: <script language="javascript"> function loadcontent(page) { document.getElementById('iframeid').src = page; } </script>
8
4305
by: Kenny Lai | last post by:
hey, Is there a way to communicate between iframes on different subdomains? e.g. from one.dot.com to two.dot.com? there is a security access restriction passing javascript commands between subdomains that we've run into. -Kenny
8
7985
by: kaaposc | last post by:
Hello! This is not question, I was just wondering, why people continue using frames and iframes when we have handy AJAX approach to fill needed divs with content. Is it because of some user's paranoia about javascript? But if they make pages without javascript, they would not need to bother, how to access other frame's content, would they? :) kaaposc
2
12827
by: ericisjusteric | last post by:
I have a page with multiple iframes and need to have the user (ie6) be able to click a button to refresh any one of the iframes - but also to click another button at the top of the page to refresh all of them - from the server (this could be on page refresh also) as the purpose is to reset the iframe to the original content in case the user clicked on a link in that iframe and changed it, but also in case there were updates to the original page...
44
584
by: John Dann | last post by:
I'm unclear as to how best to use what I'm terming the top-level CSS selectors, by which I mean selectors like *, html and body. I'm coming at this from trying to understand how best to set font sizes but I seem to have strayed into a broader question. Some CSS guides seem to suggest that a * declaration is good practice for any style sheet, primarily I suppose to set zero defaults for margin and padding for all other relevant selectors...
6
4669
by: tinman486 | last post by:
Im new to the whole javascript game, I know pretty much just enough to be dangerous with no real substance. Anyway Im trying to populate a DIV with a website using the URL as an inner html source Here is my code I keep getting an error object expecte don line 58. Which I will highlight. Anyway Not only would i Like to know what that error is about but also if my logic is correct or if I can even do what im trying... and if not what other...
0
8616
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8971
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8818
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5825
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4332
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.