-
Notifications
You must be signed in to change notification settings - Fork 2.4k
prefetching duplicate page in DOM while user click the data-prefetch link quickly after ui showed #8192
Comments
Have you got an online sample that demonstrates it?
|
Thanks for reporting the issue. If I understand you correctly you have a very heavy page with a link on it to another page which should be prefetched. If you click that link while the heavy page is still being loaded and the other page hasn't been prefetched yet, that other page will be loaded in the DOM twice. Correct? Like @Ruffio says, can you please provide a test page? Thanks! |
Yes! That’s correct. I try to make a test page with the issue shortly. I guess the pagecontainer did not prevent duplicate load of the same page internally. |
I tried with a light page with only several icons and links. The issue could be reproduced in such a situation too. |
The issue here is that your basically creating a race condition. prefetch is specifically designed to run asynchronously in the background. To fix this we will need to track pages being prefetched and save the deferred so that we can hook to that if a page is in the process of being prefetched. |
Yes, that’s the point! So, currently do you have any advice to prevent such a situation? I cannot have my users not click the link if the page is available. |
i would try making your links point to the internal url not the external one and on failure wait 1 second and try again thats probably the best you can do for now. |
Yes. You are right. But I wonder if I can listen to an event of the prefetching completion? If I can get the completion event then I can safely enable the link. But I cannot find any document on the prefetching event. Do you know anything about that? |
my page1 got some big stuffs, say, a lot of high definition pictures to load.And i have a link
Category in page1. If user click the link very quickly after page1 showed, the Jquery mobile will fetch two category page into DOM!
my Jquery mobile version : 1.4.5
The text was updated successfully, but these errors were encountered: