Get URL of page that isn't appearing in the search bar? Google instant

旧街凉风 提交于 2019-12-12 01:58:36

问题


I'm developing an extension and I've run into a problem... I'm wondering how would I grab the URL's of a Google instant search page? Since the browsers http bar doesn't update! I would really appreciate any help with this!

Google instant appears to be using ajax to generate it's results. I need a way of grabbing the new URL when the page updates.


回答1:


The hash part of the URL is updated a few seconds after the last typed key.

If you can't wait, you could be able to build the URL by serializing the search form:

// (jquery / pseudo code)
var base = $('form[name="gs"]').attr('action');
var params = $('form[name="gs"]').serialize();
var url = base + '?' + params;

The resulting URL will be similar to what it would have looked if the user submitted the form.



来源:https://stackoverflow.com/questions/4843192/get-url-of-page-that-isnt-appearing-in-the-search-bar-google-instant

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