I've posted some of
this on the official Google chrome help forum [productforums.google.com] but since there is already
an old (closed) topic in this forum about this addressing variables set inside an IFRAME [webmasterworld.com], I thought I'd join up here to add a comment on the end of that old topic about Chrome not working as it should, but when I joined, I then saw that the old topic had been closed so instead I decided to start this new topic.
First, a by-the way as to why I am using portable Chrome. I'm running Chrome portable Version 22.0.1229.94 on Windows XP - portable allows me to use a non-system directory to install the files onto and for the webpage cache thus saving system disc space which is running out.
The standard version of Chrome didn't allow me to choose and insisted on installing itself on the system disc.
Also by the way, yes I know that's an old version and someone will suggest installing the latest version to see if that fixes the error but anyway here is the issue that I want a solution to.
Have you checked our known issues page? YES - DIDN'T SEE IT.
If your issue is not there, please provide a detailed description here: Javascript doesn't work as it should, as it does for example even on Internet Explorer 7 which I also use.
Specifically, the javascript which allows you to address variables between frames, say between a web page and an embedded IFRAME webpage, doesn't work as it should.
Here is couple of test files that demonstrate the failure of Chrome.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DOC1.HTM</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor=pink>
<h1>DOC1.HTM</h1>
<iframe name="iframename" src="doc2.htm"></iframe>
<p>
<br />
<a href="#" onclick="alert('The value of the variable test_var set by a script in DOC2.HTM embedded in the DOC1.HTM page by an iframe named IFRAMENAME as read from a script running in DOC1.HTM appears to be - ' + window.iframename.test_var);return false;">check variable</a>
</p>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DOC2.HTM</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor=red>
<script type="text/javascript">
var test_var="testing, testing . . .";
</script>
<h1>DOC2.HTM</h1>
</body>
</html>
So run that in Chrome and the variable set in DOC2.HTM remains undefined - it's out of scope.
Run it in Internet Explorer and the variable is set, no problem.
The same issue arises trying to read variables the other way by using parent.variable_name from the embedded frane trying to address variables in the parent file.
The only info I get from Chrome, is a lame, worthless excuse in the Console, thus.
Unsafe JavaScript attempt to access frame with URL ... ... /doc2.htm from frame with URL ../doc1.htm. Domains, protocols and ports must match. I've edited out the folder names from the console message for clarity.
Given the extensive javascript support of Chrome compared to the primitive offerings of IE7 in that respect, I would have expect better from Chrome, that basic functions of Javascript would work.
So what's up Chrome?