Iframe with php echo not working

701 views
Skip to first unread message

Quy

unread,
Apr 3, 2010, 10:19:18 AM4/3/10
to fancybox
When I try to dynamically insert a "php echo" statement to create a
link, FancyBox opens my the iframe in a pop-up box but also loads up
the underlying window with the URL and the pop-up goes away.

Check out:

http://officialtwits.com/fancy.php

Using 1.3.1, I'm using iframe type for links with class="quick_view"

My first 3 links are hard-coded in my php file and work find but my
last link to Twitter.com is coded as

<li><a class="quick_view" href="<?php echo 'http://twitter.com'; ?
>">Twitter</a></li>

And this doesn't work.

Need help!!

Quy

Jan Wilson

unread,
Apr 3, 2010, 10:33:35 AM4/3/10
to fanc...@googlegroups.com
If you look at the page source for the Twitter page, you see that they
are using Javascript to break out of any enclosing windows. I don't
know of any way to avoid that. Maybe someone else does.

It's a question of who has the right to tell the user how he/she must
view a page. You are saying the user MUST view the Twitter page in an
iframe. Twitter is saying the user MUST view it outside of any frame.
Neither of you are giving the user a choice, but so far Twitter is winning.

--
Jan Wilson

Quy

unread,
Apr 3, 2010, 12:00:54 PM4/3/10
to fancybox
Ahh! That's right - they are using an iframe buster javascript code.

How can I detect if a page is using an iframe buster or not? I don't
want to use iframe fancybox if the page is going to bust it?

Quy

Jan Wilson

unread,
Apr 3, 2010, 12:20:14 PM4/3/10
to fanc...@googlegroups.com
Since you are using PHP, you COULD fetch the .html file, use a regex to
scan for the iframe buster, and then make a decision. But that's the
REALLY hard way.

Since you know Twitter does that, you could:

1. Not include Twitter in your links.

2. Include a link to Twitter, but not try to put it in an iframe. You
could use target="_blank" to try to force it to open in a new window.
Again, this is saying YOU have the right to decide how the user wants to
open windows, rather than letting the user decide it. That also
probably breaks the BACK button history.

3. Just leave it as it is and let Twitter continue to break the iframe
(which really isn't all that bothersome).

4. As you can probably tell, I hate websites that try to put other
websites in frames, including iframes, as a rule. Or even force them to
open in new windows. I do it when a customer insists, but I still don't
like it. There are very legitimate uses for iframes, like Google Maps,
and local popup information, or other pages that are designed to take up
a small amount of space, but I don't like putting something like a
Google search in an iframe. Why do we get the right to restrict the
user to less than a full page of results?

Quy

unread,
Apr 3, 2010, 8:30:06 PM4/3/10
to fancybox
Hi Jan,

I am allowing my users to open up sites in a new window using
target=_blank
I just wanted to put another option called "Quick View" for users who
want to see the page in an iframe without leaving my site since my
site is focused on reading a lot of news articles.

Quy

Reply all
Reply to author
Forward
0 new messages