I am running google custom search engine on web browser it works fine...i run it on emulator it works fine...but when run on android device its not running it showing either blank screen or network error or this error "file:///google.com/cse?q=.... can not be found." what might be the reason??
- 3 Posts
- 0 Reply Likes
Posted 7 years ago
Mario, Champion
- 120 Posts
- 17 Reply Likes
Why are you calling the search service with 'file:///'?
Exchanging with 'http://' should work.
Comment:
This can happen if you use an URL like that: '//google.com'
• Developing on localhost will result in 'http://google.com'
• Running on device will result in 'file:///google.com'
Hope this helps ...
Exchanging with 'http://' should work.
Comment:
This can happen if you use an URL like that: '//google.com'
• Developing on localhost will result in 'http://google.com'
• Running on device will result in 'file:///google.com'
Hope this helps ...
- 3 Posts
- 0 Reply Likes
Where to exchange http:// bcoz while passing the query I am giving url header as "http://" only...
Mario, Champion
- 120 Posts
- 17 Reply Likes
Sounds strange to me. Hard to tell without seeing some code. Maybe one can help if you post the relevant lines of your code.
- 3 Posts
- 0 Reply Likes
I am using google v2 code and made one html file and passing a search string as query string to that html file
The html file is below:-
var parameters = location.search.substring(1).split("&");
var temp = parameters[0].split("=");
var query= unescape(temp[1]);
var myCallback = function() {
google.search.cse.element.getElement('q').execute(query);
};
// Insert it before the CSE code snippet so that cse.js can take the script
// parameters, like parsetags, callbacks.
window.__gcse = {
callback: myCallback
};
(function() {
var cx = 'id'; // Insert your own Custom Search engine ID here
var gcse = document.createElement('script'); gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
body
gcse:searchresults-only gname="q" autoSearchOnLoad="true"
/gcse:searchresults-only
/div
/body
/html
and i am passing search string from another page like this:
query="Hello"
window.location.assign("filename.html?&q="+query);
i have not put<> in tags as it was not accepting....
The html file is below:-
var parameters = location.search.substring(1).split("&");
var temp = parameters[0].split("=");
var query= unescape(temp[1]);
var myCallback = function() {
google.search.cse.element.getElement('q').execute(query);
};
// Insert it before the CSE code snippet so that cse.js can take the script
// parameters, like parsetags, callbacks.
window.__gcse = {
callback: myCallback
};
(function() {
var cx = 'id'; // Insert your own Custom Search engine ID here
var gcse = document.createElement('script'); gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
body
gcse:searchresults-only gname="q" autoSearchOnLoad="true"
/gcse:searchresults-only
/div
/body
/html
and i am passing search string from another page like this:
query="Hello"
window.location.assign("filename.html?&q="+query);
i have not put<> in tags as it was not accepting....
Mario, Champion
- 120 Posts
- 17 Reply Likes
As far as I understand your code snippet, 'filename.html' is a file that resides in your app. When you assign a file as the location, like ...
... a 'file://' URL will be used.
I am pretty sure that’s the problem, but I don't have a solution for you.
The same problem was asked at StackOverflow, but with a solution that might not help you.
stackoverflow/q/6685942
window.location.assign("filename.html?q="+query);
... a 'file://' URL will be used.
I am pretty sure that’s the problem, but I don't have a solution for you.
The same problem was asked at StackOverflow, but with a solution that might not help you.
stackoverflow/q/6685942
- 8261 Posts
- 263 Reply Likes
This probably a pathing issue sending query to the URL.
Anyway, for question not directly related to Build service, please continue at the following channel:
PhoneGap Google Group: https://groups.google.com/forum/?from...
Cordova @ Stackoverflow: http://stackoverflow.com/questions/ta...
IRC Channel: Server: irc.freenode.net | Channel: #phonegap
Dedicated PhoneGap Paid Support: http://phonegap.com/support/
Developers Directory: http://people.phonegap.com/
Thanks!
Anyway, for question not directly related to Build service, please continue at the following channel:
PhoneGap Google Group: https://groups.google.com/forum/?from...
Cordova @ Stackoverflow: http://stackoverflow.com/questions/ta...
IRC Channel: Server: irc.freenode.net | Channel: #phonegap
Dedicated PhoneGap Paid Support: http://phonegap.com/support/
Developers Directory: http://people.phonegap.com/
Thanks!
This conversation is no longer open for comments or replies.
This conversation is no longer open for comments or replies.
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers

