Is it possible to programmatically change the default search engine for the Iphone?

删除回忆录丶 提交于 2020-01-02 10:08:44

问题


We want to build a webpage that requests permissions from an iphone user to change their default search provider. Is this possible with through mobile safari?


回答1:


The Window object in Mobile Safari on iOS has what appear to be three undocumented functions that make interaction with the default search engine possible:

window.canSetSearchEngine()
window.getSearchEngine()
window.setSearchEngine(string)

The Yahoo mobile search site uses these functions to throw a (very annoying) dialog box asking "Would you like to change your default search engine to Yahoo? y/n".

I haven't yet been able to make the setSearchEngine() function work because for some reason I don't have permission to do so (i.e., canSetSearchEngine() returns false).

I know the Yahoo code works so it appears that it must be possible to do. I wonder if the js file has to be hosted on a whitelisted domain related to the selected search engine. IOW - perhaps only js code served from a yahoo, google, or bing domain has permission to call the setSearchEngine() function.

Cheers!

jonathanstark




回答2:


Afraid not, no.



来源:https://stackoverflow.com/questions/2960788/is-it-possible-to-programmatically-change-the-default-search-engine-for-the-ipho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!