I can't figure out why the Google search on my Web site works on other browsers but not when using Firefox.
After the Google Search engine on my Web site stopped working, I recently had to upgrade my Custom Search Element Control API (https://developers.google.com/custom-search/docs/element) to v2. A strange thing we have noticed is that the search engine works on all the other browsers we tried except Firefox. You get a weird grayed out page for search results, which looks like top results from Google of your search string on the Web, and then no other results, but you can't do anything on the page.
I've taken off the identifying information from the code Google has told me to add. I've Googled this question to death and so far have been unable to find anyone else who has reported this problem or a solution. Has Firefox somehow disallowed something in either or both sets of code to stop the script from running? Thanks VERY much in advance for your help!
SET ONE OF CODE (to code for the search box) == <script>
(function() { var cx = '#####'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })();
</script> <gcse:searchbox-only></gcse:searchbox-only>
SET TWO OF CODE (to code for the search results) ==
<script>
(function() { var cx = '####'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })();
</script> <gcse:searchresults-only></gcse:searchresults-only>
Alle Antworten (7)
I actually have the last search that actually worked in Safari open in Safari. I opened the page source and worked backwards from it to make sure the code in Wordpress matched what was in the page source. Still not working. Baffled!
jscher2000 said
You could check search engine caches for the old page code. Google: https://webcache.googleusercontent.com/search?q=cache:K24NzqPQ8SwJ:https://www.onlinecomputertips.com/search+&cd=2&hl=en&ct=clnk&gl=us&client=firefox-b-1-ab
I apologize in advance, this might be a really elementary question and it's not related to Firefox at all. Is the search results detail set up properly? I'm attaching what's in that window on the Google side.
What I find odd is that on the header code within the page source for *the search that worked*, I've got this code. Isn't the below code telling Wordpress to open a page with that name? I've made a screenshot of the top of the working search.
<gcse:searchbox-only resultsUrl="search-results"></gcse:searchbox-only>
I went back to an old CSE I had set up years ago and generated the updated code. Previously, it loaded a page on Google and now it injects the results in the page with the search box. https://www.jeffersonscher.com/
I do not have that "Search Results Details" button shown in your screenshot. Maybe I have to create a new search engine to get that button?
Not sure TBH. I do know that the way we had things set up with the CSE v1 opened results in a new page. And with v2, there's loads of options on how you can set up how the results output.
https://developers.google.com/custom-search/docs/js/cselement-devguide
As crawled by the Wayback Machine in September. I was able to confirm by trying to run a search (unsuccessful b/c not crawled) that the page the results go onto is http://www.theregoesthefear.com/search-results/?q=#### (#### being the search string). https://web.archive.org/web/20170710082347/http://www.theregoesthefear.com/
jscher2000 said
I went back to an old CSE I had set up years ago and generated the updated code. Previously, it loaded a page on Google and now it injects the results in the page with the search box. https://www.jeffersonscher.com/ I do not have that "Search Results Details" button shown in your screenshot. Maybe I have to create a new search engine to get that button?
Their demo for the separate results page has:
<!-- Place this tag where you want the search box to render --> <!-- Results URL is saved in CSE control panel "Get Code" tab. --> <gcse:searchbox-only></gcse:searchbox-only>
http://googlecustomsearch.appspot.com/elementv2/two-page_v2.html
That's right. When you click the "Get Code" button, you get the attached screenshot. The white box on the right in the screenshot is the box that pops up when you click "Search Results Details".
jscher2000 said
Their demo for the separate results page has: <!-- Place this tag where you want the search box to render --> <!-- Results URL is saved in CSE control panel "Get Code" tab. --> <gcse:searchbox-only></gcse:searchbox-only> http://googlecustomsearch.appspot.com/elementv2/two-page_v2.html
What seems to work for me on search result pages is to click the Next button that has a '404 error' tooltip and then use the Firefox Back button to return from the error page to the search results page. The Network Monitor shows that a different apiary### is used. That was for v1element cases, so I don't know if that works with version 2 as well as a possible Troubleshooting step.