By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,743 Members | 1,058 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,743 IT Pros & Developers. It's quick & easy.

frame burst of images.google

P: n/a
there's this one i can't figure out.

I'm trying to kick out image.google.com's top frame when it goes to my
page.

If you go to
http://images.google.com/images?q=milk+tits
click on the page
http://xahlee.org/Periodic_dosage_di...caryatids.html
it should kick out the google's frame, but it isn't.

If i put a alert() in the script, it won't even popup. But i can't see
anywhere in google's html that has js or disables js.

however, it works in safari, but not in Mac Opera nor Mac Firefox nor
iCab. However, it all works if run from localhost with the frameset and
top frame from downloaded google.

any ideas?

Xah
xa*@xahlee.org
http://xahlee.org/

Feb 11 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Xah Lee wrote:
[...]
I'm trying to kick out image.google.com's top frame when it goes to my
page.

If you go to
http://images.google.com/images?q=milk+tits
click on the page
http://xahlee.org/Periodic_dosage_di...caryatids.html
it should kick out the google's frame, but it isn't.

If i put a alert() in the script, it won't even popup. But i can't see
anywhere in google's html that has js or disables js.
Your code is (pretty-printed):

function f()
{
if (window.top.location.href != window.self.location.href)
{
window.top.location.href = window.self.location.href;
}
}
window.setTimeout(f,1000*3);

Following <URL:http://jibbering.com/faq/#FAQ4_43> would have told you that
it causes

| Error: uncaught exception: Permission denied to get property Location.href

You are attempting to read `window.top.location.href'. Since the domain
of the frameset document's URL is "images.google.com" and the domain of the
URL of the frame document that contains the accessing code is "xahlee.org",
the Same Origin Policy forbids that. Do not compare locations but compare
object references instead.

Your window.setTimeout() call is unreliable; if window.setTimeout(), a
host object's method, is not supported, your script breaks; if it takes
more then 3 seconds to load the frameset completely, your script breaks;
if Function object references are not supported as first argument of
window.setTimeout(), your script fails or breaks.

Either or both may be the reason why no further script code (e.g.
`alert(...)') is executed then. Furthermore, `window.self' is
referring to the same object as `window' does, so it is inefficient
to use the former.

Try this:

function isMethodType(s)
{
return (s == "function" || s == "object");
}

if (typeof window != "undefined"
&& isMethodType(typeof window.setTimeout)
&& isMethodType(typeof window.clearTimeout))
{
var f = function()
{
if (typeof window.top != "undefined")
{
if (window.top)
{
if (window != window.top)
{
window.top.location = window.location;
}
else
{
if (typeof f.timeout != "undefined")
{
window.clearTimeout(f.timeout);
}
}
}
else
{
f.timeout = window.setTimeout("f()", 3000);
}
}
};

f();
}
however, it works in safari, but not in Mac Opera nor Mac Firefox nor
iCab. However, it all works if run from localhost with the frameset and
top frame from downloaded google.


The domain (localhost) is the same then.

BTW: Your markup is not Valid. <URL:http://validator.w3.org/>

BTW 2: This has nothing to do with stylesheets, so do not crosspost to
comp.infosystems.www.authoring.stylesheets.
F'up2 comp.lang.javascript

PointedEars
Feb 11 '06 #2

P: n/a
Xah Lee wrote:
«I'm trying to kick out image.google.com's top frame when it goes to
my
page.

If you go to
http://images.google.com/images?q=milk+tits
click on the page
http://xahlee.org/Periodic_dosage_di...caryatids.html
it should kick out the google's frame, but it isn't.
»

Thomas 'PointedEars' Lahn wrote:
«...»

nice suggestions, but none are useful in this context.

this is quite puzzling. Because after tried many things to diagnose the
problem, it might be that google has implemented some mechanism so as
to disable kicking out their frames. Because, when i tweaked the
script with some variation, clicking on the google image will result in
my page being completely blank below the google's panel frame, as if my
page tried to refresh and got botched. Or, some variation results both
google's top frame being blank as well as my page... but it works in
Safari and i couldn't locate any <script> in google's sources.

if i put a alert() in my page, it may or may not act depending on the
script variation i'm using.

Here's a variation that should just work:
<script type="text/javascript" defer>
if ( window.top != window.self) {window.top.location.href =
window.self.location.href;}
</script>

i've tried combinations of using “defer”, setTimeout,... itmay be
hard to test because it works locally. You'll need to find a search
string in google images so that it hits your page.

Xah
xa*@xahlee.org
http://xahlee.org/

Feb 11 '06 #3

P: n/a
Frameset Infinity!
http://xahlee.org/js/frame2/frameset.html

HTML Frame tutorial + Infinity!
http://xahlee.org/js/frame/0.html

Xah
xa*@xahlee.org
http://xahlee.org/

Feb 14 '06 #4

P: n/a
"Xah Lee" <xa*@xahlee.org> writes:
Frameset Infinity!
http://xahlee.org/js/frame2/frameset.html
Brilliant!

HTML Frame tutorial + Infinity!
http://xahlee.org/js/frame/0.html


Delightful!
Arnaud
Feb 14 '06 #5

P: n/a

"Xah Lee" <xa*@xahlee.org> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Frameset Infinity!
http://xahlee.org/js/frame2/frameset.html

HTML Frame tutorial + Infinity!
http://xahlee.org/js/frame/0.html

Why oh Why????
Feb 14 '06 #6

P: n/a
Just created Tab Menu tutorial.

Two tutorials for Tab Menu.

JavaScript implementation:
http://xahlee.org/js/tabs/a.html

Pure CSS implementation:
http://xahlee.org/js/tabs2/a.html

Xah
xa*@xahlee.org
http://xahlee.org/

Feb 19 '06 #7

P: n/a
In article <11*********************@g47g2000cwa.googlegroups. com>,
Xah Lee <xa*@xahlee.org> wrote:
Just created Tab Menu tutorial.

Two tutorials for Tab Menu.

JavaScript implementation:
http://xahlee.org/js/tabs/a.html
I avoid javascript whenever possible. Tabs are much simpler in CSS.
Pure CSS implementation:
http://xahlee.org/js/tabs2/a.html


This is an example of how NOT to do it, in my opinion.

You don't need to express tabs as a list. This is especially
important for tabs, which you may want to look like a horizontal
list of links for non-css browsers, rather than a vertical list of
links.

All you need is a border and color definition for the 'A' tag. Then
your tabs are as simple as a series of links:

<div id="nav">
<a name="#" id="current">current active tab</a>
<a href="page1.html">page 1 tab</a>
<a href="page2.html">page 2 tab</a>
</div>

See? No <ul...> list required.

The following CSS definitions for the HTML above will result in a nice
series of tabs, with the current tab having no bottom border to look
continuous with the page:

#nav { /* navigation bar which will have the tabs */
font-size: 1em;
text-decoration: none;
clear: both;
padding-top: 1px;
padding-left: 4px;
border-bottom: 1px solid #000000;
white-space: nowrap;
}
#nav a, #nav a:hover, #nav a#current { /* basic tab properties */
font-size: 1em;
text-decoration: none;
border-top: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
padding-left: .2em; padding-right: .2em;
padding-bottom: 0px;
}
#nav a { /* normal color of tab is CCCCCC */
border-bottom: 1px solid black;
color: #000000;
background-color: #CCCCCC;
}
#nav a:hover {
border-bottom: 1px solid black;
color: #000000;
background-color: #CCFFFF;
}
#nav a#current { /* color of "current" tab is white with green text */
border-bottom: 1px solid white;
color: #009933;
background-color: white;
}

-A
Feb 19 '06 #8

P: n/a
axlq wrote:
In article <11*********************@g47g2000cwa.googlegroups. com>,
Xah Lee <xa*@xahlee.org> wrote:
http://xahlee.org/js/tabs2/a.html
You don't need to express tabs as a list. This is especially
important for tabs, which you may want to look like a horizontal
list of links for non-css browsers, rather than a vertical list of
links.


When CSS isn't applied, a vertical list is a much better fallback than a
horizontal list, from both usability and accessibility standpoints.
<div id="nav">
<a name="#" id="current">current active tab</a>
<a href="page1.html">page 1 tab</a>
<a href="page2.html">page 2 tab</a>
</div>

See? No <ul...> list required.
And how do you think a screen reader will interpret this, as opposed to
list markup? How about Lynx? You've created a serious readability
problem, if nothing else.
The following CSS definitions for the HTML above will result in a nice
series of tabs,


....but only for graphical desktop browsers. You've completely ignored
any other browsing environment. :(

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Feb 19 '06 #9

P: n/a
In article <45************@individual.net>, kchayka <us****@c-net.us> wrote:
axlq wrote:
See? No <ul...> list required.


And how do you think a screen reader will interpret this, as opposed to
list markup? How about Lynx? You've created a serious readability
problem, if nothing else.


I always TEST things on Lynx. The example will look like a horizontal
list of links, exactly as I intend. It's a horizontal list of links on
ALL browsers. The only difference is that on CSS browsers, pretty
little borders appear around the links.
The following CSS definitions for the HTML above will result in a nice
series of tabs,


...but only for graphical desktop browsers. You've completely ignored
any other browsing environment. :(


Wrong. What I proposed was INTENDED for other environments.

-A
Feb 20 '06 #10

P: n/a
axlq wrote:
[again nothing that is on-topic in cljs]


The relevance this discussion once had to J(ava)Script/ECMAScript
programming, it does not have it anymore. Please stop crossposting
to comp.lang.javascript, unless you are going to introduce that
relevance again, and set Followup-To where it is appropriate.

Thanks in advance.
PointedEars
Feb 20 '06 #11

P: n/a
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote:
axlq wrote:
[again nothing that is on-topic in cljs]


The relevance this discussion once had to J(ava)Script/ECMAScript
programming, it does not have it anymore. Please stop crossposting
to comp.lang.javascript


Please stop replying to posts with just header tweaking to keep your
precious cljs group clean. It doesn't work, as I explained to you before.

A crosspost without a follow up can not be "fixed" afterwards. Trying to
change things only add to the noise.

--
John Skilled Perl programmer for hire: http://castleamber.com/

Fox noGO:http://johnbokma.com/firefox/removin...earch-bar.html
Feb 20 '06 #12

P: n/a
Events: A Introduction to the Model of GUI programing
http://xahlee.org/js/events.html

Comments welcome. Thanks.

Xah
xa*@xahlee.org
http://xahlee.org/

Mar 4 '06 #13

P: n/a
Xah Lee wrote:
Events: A Introduction to the Model of GUI programing
http://xahlee.org/js/events.html

Comments welcome. Thanks.


The main benefit of writing explanatory material is that authors gain a
better understanding of what they are writing about. I've written
similar stuff but keep it to myself since releasing it to the public
would probably do more harm than good... :-)

Some comments on your article:
*Superficial*
You don't go into very much depth at all, leaving your readers to learn
just about everything from your MSDN references - as a result, they will
likely write IE-centric code and wonder why it doesn't work in other
browsers.
*Different event models*
You don't mention that there are two different event models, a pretty
fundamental concept for using events in browsers.
*References*
You have many reference to Microsoft resources, but none to the W3C.
Given that W3C is more important as a standards setting body, they
should be your primary reference.

MSDN should only be referenced where a suitable W3C reference doesn't
exist. Wherever an MSDN reference is used, an equivalent reference for
other platforms should be included - say Gecko and Opera at least (where
available).

There are some good articles about events, you should also reference
those, e.g. Quirksmode:

<URL: http://www.quirksmode.org/js/introevents.html >

and check your article for consistency with them.
*Attaching events*
You note two methods for attaching events, but there are others such as
addEventListener and attachEvent - but that would require you to explain
that there are two different event models.

*Event properties*
No mention is made of event properties, or even of event objects.
--
Rob
Mar 7 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.