开发者

loadURI() and # FF addon

I am developing a Firefox addon for faster searching. I'm using loadURI to load the URLs. What I encountered is that sometimes Firefox wouldn't load the newest request.

Example:

getWebNavigation().loadURI("http://www.google.com/", (nsIWebNavigation.LOAD_FLAGS_IS_LINK), null, null, null);

getWebNavigation().loadURI("http://www.google.com/#5555", (nsIWebNavigation.LOAD_FLAGS_IS_LINK), null, null, null);

If you execute it, it will load http://www.google.com/#5555 first; and on all other requests it will load google.com.

nsIWebNavigation.LOAD_FLAGS_IS_LINK is required for Google to not reload images and javascript. Bypassing cache works but it has the problem that page is always renewed.

I'm looking for a way to give the latest request priority, while simultaneously not reloading images & javascript.

Before you answer, the following flags do not resolve the problem:

LOAD_FLAGS_STOP_CONTENT (STOP_NETW开发者_JAVA百科ORK, STOP_CONTENT, STOP_ALL),...
LOAD_FLAGS_FIRST_LOAD


The original loadURI of http://www.google.com/ starts attempting to load. However your immediate load of http://www.google.com/#5555 interrupts the load and starts loading http://www.google.com/#5555 which then proceeds to load.

Once http://www.google.com/#5555 is loaded, you then issue another load of http://www.google.com/ however this time the subsequent load of http://www.google.com/#5555 only does an anchor scroll (this is true whether the current page is http://www.google.com/ or http://www.google.com#5555) which does not interfere with the load of http://www.google.com/ which then completes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜