how to open google links inside iframe? - php

i am trying to open a google search inside an iframe. it was working until recently but something happened.
this can be tested here: http://jsfiddle.net/patrioticcow/xTjyX/
i also added &output=embed at the end of the link, but it looks like it doesn't help.
in chrome i get: Refused to display document because display forbidden by X-Frame-Options.
but it doesn't work in Mozilla also.
any ideas?
thanks

The X-Frame option is a header sent by the webserver of the page you are trying to embed into the iframe. It basically tells the browser not to allow embedding the page in an iframe. Have a look at https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header for a more detailed description.
Obviously Google does not want you to embed it's search results into an iframe.

We are seeing the same problem - this time with google in a standard frame. It was fine a couple of months ago, now it's not working. I think that Google just changed the rules... Not a very open thing to do.
I'd suggest that you run what was in the iframe as a separate child window or new tab - not sure if this will give you the result you wanted.

Related

Cookies in Iframe page loaded with Curl

On http://aegon.nl you'll get an opt-in which only displays when you haven't got the right cookie set for the website.
Now I'm trying to load the website in an Iframe with an injected file (to do some fancy stuff with javaScript). To be able to do that, I need to CURL the sourcecode and change the base href to "aegon.nl" in order to show the same layout (for the url's to the stylesheets and such).
Now, been there and done that. But now I've got a problem with the cookies. I can click the button in the opt-in as many times as I want, but It keeps coming back. I only have this problem after CURLing the content and changing the base href.
After searching the sourcecode I think I found the problem:
var dom=(window.location.hostname.indexOf(".")>0)?'aegon.nl':window.location.hostname;
var AEGONCookieSettings = new AEGON.CookieOptIn(dom)
Probably the problem is solved by changing this part of sourcecode.... But that doesn't solve the problem for the other websites which are using the same kind of opt-in.
Does anyone have a solution for this?

Unable to download og:image, although it's accessible from withing the debugger

We're a website completely written in PHP, we use facebook metatags since we provide facebook sharing, liking, etc...
problem is when we share a link from our site to facebook, it shows the picture correctly, however trying to reshare the same link from another user, removes the picture and shows the link only.
Further troubleshooting using the FB debug tool shows below error message:
Unable to download og:image‎‎‏: The image referenced by the url of og:image tag could not be downloaded.‎
The weird thing is that the image is already see and accessible in the debugger!!
A sample page:
http://fbcomics.com/home/index/92/date/1462
Debugger for it:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Ffbcomics.com%2Fhome%2Findex%2F92%2Fdate%2F1462
Your cooperation is highly appreciated.
I think that you probably need to urlencode() the url value going into the content attribute of your og:image meta tag.
This might be related to a recent Facebook bug. https://developers.facebook.com/bugs/239522122851150
Issue was solved by itself. It seems that Facebook needs sometime (weeks I think) to store the page information including the picture using its crawlers.
If you face this, most probably you'll need to wait for sometime before sharing your new pages.
Thanks,

iframe workaround to load http://www.google.com in a webkit browser

So the latest version of Chrome and maybe Safari too doesn't let you load in iframes inless you're on the same domain for certain websites that don't want to be iframed like google.com.
<iframe src="http://www.google.com" style="width:600px;height:500px;" frameborder="0"></iframe>
The Error I get in Chrome is..
Refused to display document because display forbidden by X-Frame-Options.
Is there a workaround to avoid this error and display the iframe.
From what I read the x-frame stuff is to prevent click jacking via iframe, but I'm not trying to do that I just want to load in the site the way the iframe I thought was supposed to perform.
Is there away around this using PHP?
No, there is no way to bypass this restriction.

Crawl Website using PHP

I've tried a bunch of techniques to crawl this url (see below), and for some reason the title comes back incorrect. If I look at the source of the page with firebug I can see the correct title tag, however, if I view the page source it's different.
Using several php techniques I get the same result. Digg is able to crawl the page and parse the correct title.
Here's the link: http://lifehacker.com/#!5772420/how-to-make-ios-more-like-android
The correct title is "How to Make Your iPhone (or Other iOS Device) More Like Android"
The parsed title is "Lifehacker, tips and downloads for getting things done"
Is this normal? How are they doing this? Is there a way to get the correct title?
That's because when you request it using PHP (without any JS support) you're getting the main page of lifehacker - which is lifehacker.com.
Lifehacker switched their CMS recently so that all requests go to an initial page and then everything after the hashbang is read by a JS script in the main page to figure out which page needs to be served. You need to modify your program to take this into account
EDIT
Have a gander at these links
http://code.google.com/web/ajaxcrawling/docs/getting-started.html
http://www.tbray.org/ongoing/When/201x/2011/02/09/Hash-Blecch
Found the answer:
http://lifehacker.com/#!5772420/how-to-make-ios-more-like-android
becomes:
http://lifehacker.com/?_escaped_fragment_=5772420/how-to-make-ios-more-like-android

Forcing Google Adsense to load after actual webpage?

On my site, I have google adsense in my right hand side nav bar. The problem I find is because the adsence code is placed before the actual webpage content, as I use includes in php to pull my site template in, I find that it loads the adsence code first and can cause everything else to load after it.
Does anyone know of a good way that I can force it to loads after the actual webpage loads?
Hi i managed to solve it. I found this: How to make Google Adsense load last after the rest of page and someone replied with a link to show how to do it. Solved. Thanks :)
http://www.plus2net.com/php_tutorial/sleep.php
Something like this?
Or use a javascript settimeout and display an ajax loader gif whilst it loads.
More info on AJAX preloaders: http://blog.twostepmedia.co.uk/jquery-ajax-gif-preloader/
If you can edit your site's template, then you should be able to edit the Adsense loader. Find where it is being included on your template and move it down, to just before the closing </body> tag.

Categories