Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome bookmark loads cached content #18

Open
lilx2018 opened this issue Dec 17, 2021 · 15 comments
Open

Chrome bookmark loads cached content #18

lilx2018 opened this issue Dec 17, 2021 · 15 comments

Comments

@lilx2018
Copy link

lilx2018 commented Dec 17, 2021

I use widdler as local web server, and chrome as the web browser. I found that when I modified a tiddler , saved the tiddler, widdler told me that it saved succes, so I closed chrome browser. But next time I opened the modified tiddler, the browser shown me the old content which before modified!!! I must click refresh button to refresh the content (refresh button work well).

Maybe this caused by the cache of chrome, but this behave is very dangours when I start to next modify the same tiddler. It casuse me lost the modified content frequently.

Any one can help me to void this problem?

OS: win10, Browser: chrome version 96.0.4664.110, Tiddlywiki version 5.2.1, widdler: build from sourecode myself

@lilx2018
Copy link
Author

I bookmarked my local tiddlywiki as "localhost:8080/mywiki5.2.1.html", and open this wiki ("localhost:8080/mywiki5.2.1.html") by click the bookmark bar of chrome.

When I used Timimi as save tools, I didn't find any "refresh" problem, so I think it may be not due to "the cache of chrome".

@amreus
Copy link

amreus commented Dec 17, 2021

I am going to make a guess here.

widdler serves the folder where the widdler executable is located by default. It does not use the current directory.

You need to use the -wiki parameter to tell widdler which folder to serve.

@qbit
Copy link
Owner

qbit commented Dec 17, 2021

@lilx2018 can you paste the full widdler command you run? Also, do you have any plugins installed (in the wiki)?

@lilx2018
Copy link
Author

I download the release build v1.2.3 and test, it has same problem.

command line: widdler -auth=false -wikis lilixiong

image

@lilx2018
Copy link
Author

the wikifile locate at G:\workspace\leanote\tools\widdler\lilixiong\mywiki5.2.1.html, the command line (exe) work directory is G:\workspace\leanote\tools\widdler

@lilx2018
Copy link
Author

lilx2018 commented Dec 18, 2021

I run a visualC++ rebuild task to make computer very busy, the problem repeat almost every time when I click the bookmark toolbar button.

So I copy "localhost:8080/mywiki5.2.1.html" to the url addres input editor instead click bookmark toolbar button, I can't find the problem occur again, this make me guess that if open a webpage by url address if will always reload the content, and maybe do more work which I don't understand.

(* THESE ARE NOT TRUE
Evil, after through open by url address, now I open my wiki through bookmark button (with runing visualC++ rebuild), I can't find the problem repeat again.

But beacuse the problem is occur randomly,I will do more test, if not occur again, I will close this issue.
THESE ARE NOT TRUE *)

After restart my computer, if I open my wiki by click the bookmark toolbar button, I find the problem still exist.

@lilx2018
Copy link
Author

I don't know this will help or not.

step 1: I open browser and click bookmark "mywiki", the log show that
127.0.0.1:58859 (18 Dec 21 18:43 +0800) [GET] "/mywiki5.2.1.html HTTP/1.1" 000
127.0.0.1:58859 (18 Dec 21 18:43 +0800) [OPTIONS] "/mywiki5.2.1.html HTTP/1.1" 000
127.0.0.1:58859 (18 Dec 21 18:43 +0800) [GET] "/favicon.ico HTTP/1.1" 000

step 2: I modify a tidder, and save, the log show that
127.0.0.1:58859 (18 Dec 21 18:43 +0800) [PUT] "/mywiki5.2.1.html HTTP/1.1" 5728041

step 3: I close browser

step4: I open browser and click bookmark "mywiki", this time the log show that
127.0.0.1:58876 (18 Dec 21 18:44 +0800) [OPTIONS] "/mywiki5.2.1.html HTTP/1.1" 000
127.0.0.1:58876 (18 Dec 21 18:44 +0800) [GET] "/favicon.ico HTTP/1.1" 000
this time NO [GET] "/mywiki5.2.1.html HTTP/1.1" 000, and I get the ** content is outdated before modified **.

step5: I reload "mywiki", the log show that
127.0.0.1:58876 (18 Dec 21 18:45 +0800) [GET] "/mywiki5.2.1.html HTTP/1.1" 000
127.0.0.1:58876 (18 Dec 21 18:45 +0800) [OPTIONS] "/mywiki5.2.1.html HTTP/1.1" 000
after reload, I get the ** content after modified **.

@qbit
Copy link
Owner

qbit commented Dec 18, 2021

Crazy, it seems chrome caches the bookmarks differently to entered urls.

@qbit
Copy link
Owner

qbit commented Dec 18, 2021

@lilx2018 Is the G drive or any folder containing the wiki files a shared folder?

@lilx2018
Copy link
Author

@qbit No any shared folder on G driver, but driver G is a removable SDD.

@lilx2018
Copy link
Author

THe page https://www.cnblogs.com/ziyunfei/p/6308652.html give some information about the difference between open by addressbar url and open by bookmark of chrome reload ( but it is Chinese), say that if open by hyperlinks to web pages or bookmark, Chrome will made no web request (unless the cache expires).

There are two way to avoid this problem:

  1. each time you modify your wiki file, save and do a reload immediate;
  2. each time start chrome and open your wiki file, do a reload manual;

不知道你们注意过没有,除刷新外,常规加载一个网页的途径有两种,最常见的一种是通过点击其他页面的超链接(包括浏览器书签)进入当前页面,还有一种是在浏览器地址栏上输入网址并回车(高级用户),这两者在发送请求上也是有区别的。前者是不会发起任何条件请求的(除非缓存过期),而后者是会为页面资源本身发起条件请求的(你可以用上面的 demo 做测试),Chrome 新的这个刷新机制其实就是把刷新改得和在地址栏回车一样了。鉴于现如今的大多页面都是动态页面(没有 Cache-Control/Expires/Last-modified 响应头),不会被缓存,所以如今这三者在 Chrome 上的差别已经很小了。

@lilx2018
Copy link
Author

Close the issue because it is a new "reload policy" of new Chrome version.

@lilx2018
Copy link
Author

Add following lines to wikifile seem solve the problem:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

@lilx2018
Copy link
Author

Unfortunately, more tests show that only adding following lines not solve the problem, the refresh problem still exists.

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

@qbit qbit changed the title widdler can not refresh the modified content Chrome bookmark loads cached content Jan 16, 2022
@qbit qbit reopened this Jan 16, 2022
@lilx2018
Copy link
Author

I don't know if it's appropriate to say that twserver-go do not find the same problem after enough tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants