For some reason this is not important, I'm trying to combine Google purchases with another page through an iframe.
I tried the suggested approach here , consisting of embedding a Google custom search query in an iframe, but Google Custom Search does not allow access to the shopping tab.
I realized that if you canβt implement Google, insert yourself into it. So I started introducing some jQuery on the page
var jq = document.createElement('script'); jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(jq); // ... give time for script to load, then type. jQuery.noConflict();
clear the google search results page according to the search schedule with what I need, namely the html inside the div # search
jQuery(function($) {$('#search').show().parentsUntil('body').andSelf().siblings().hide();});
Create an iframe and enter it:
var iframe = document.createElement('iframe') iframe.src="http://example.com" iframe.width="100%"; iframe.height="500"; iframe.style="visibility:visible"; document.body.appendChild(iframe)
The only problem is that the iframe does not load the contents of the page and, in turn, is empty. If you try the above snippet on any other page, it works. It looks like Google is blocking the iframe from loading. How can I get around this?
source share