cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to disable cache in embedded chromium browser

Mat
13-Aquamarine
13-Aquamarine

How to disable cache in embedded chromium browser

Hi there,

 

how can the browser cache be disabled in embedded chromium browser?

Some sources say, that You just can open Chrome and disable it via settings -> more tools -> developer tools -> Network -> "disable cache".

But this seems only to work for the "real" chrome browser and has no effect on the embedded browser.

 

In the embedded chrom(ium) browser only refreshes the base page (e.g. test.php) and its included javascript (<script src="test.js" type="text/javascript" ></script>) but not javascript files, that were included afterwards ( document.write("<script type=\"text/javascript\" src=\"my-lib.js\" charset=\"utf-8\"><\/script>'); )

 

any help would be appreciated.

Thanks

/me

1 ACCEPTED SOLUTION

Accepted Solutions
zemanekp
13-Aquamarine
(To:Mat)

I'm not sure it's related to Cache in the embedded Chromium browser. I performed a simple test:

Some page test.html with <script src="writejs.js"></script>  calling. The source writejs.js has:

document.write("<p>loaded</p>")
document.write("<script type=\"text/javascript\" src=\"writeload2.js\" charset=\"utf-8\" ><\/script>")
 
The source writeload2.js contain:
document.write("<p>loaded from writeload2</p>")
 
When refresh test.html the content is updated each time I change writeload2.js injected with document.write.
The same behavior is in Chrome, whether I use Disable Cache or not.
 
(I don't use php, it's tested via node.js. And your example, could be more more complex.)
 
I assume the problem will be more in the definition of your server-side HTTP headers. See and check header Cache-Control definition.
E.g. max-age can cause that the browser does not check the ETag of the modified file.
If you have set HTTP Response as Cache-Control: public, max-age=3600, it takes hour to browser reload source file.
 
I have other tips:
  • try to use debbuging of embedded chromium browser through CEF_DEBUG_PORT
  • if possible, avoid to use document.write (e.g. createElement instead that) - see 'Intervening against document.write()' and docu
  • prior to HTML5 i see somthing like <META http-equiv=Cache-Control content=no-cache,no-store,max-age =0> (but I think it should be solved on the server side)

BTW: to suppress the Cache of embedded browser, could be probably use the --disable-application-cache flag, but I'm convinced that PTC does not allow (accessible) to configure the startup attributes of the zbcefr.exe Chromium process.
Use the CEF_DEBUG_PORT debug system and watch the HTTP headers of files.

 

Good luck

PZ

View solution in original post

4 REPLIES 4
dnordin
15-Moonstone
(To:Mat)

Mat,

You can view where the PTC embedded Chromium cache area is located by entering the address chrome://version/ in the embedded browser.  There is a sub-folder for Code Cache.  You can test clearing/modifying the cache area directly, although I have not tested this at all, and have no idea what may happen [I'm not a java code guy].  It might be worth testing at any rate.  We sometimes have to clear the entire cache area (without Creo Parametric running), to fix issues with the browser being hung up.

 

We tried to modify the PTC embedded Chromium browser settings using typical Chromium configuration files, but nothing seemed to work.  We were trying to modify simple items like being able to modify the font size.

 

Regards,

 

Dan N.

Mat
13-Aquamarine
13-Aquamarine
(To:dnordin)

Thanks for Your replay, Dan.

 

unfortunately, I can confirm, that You cannot delete all cache files "on the fly", as You described.
You have to quit Creo every time before You want to delete all cached data.

 

I cannot believe, that PTC let its customers struggle with that kind of garbage UI (either garbage, because You only get "last week's" version of the internet, or garbage, because they hide a maybe existent preference panel "that good").

zemanekp
13-Aquamarine
(To:Mat)

I'm not sure it's related to Cache in the embedded Chromium browser. I performed a simple test:

Some page test.html with <script src="writejs.js"></script>  calling. The source writejs.js has:

document.write("<p>loaded</p>")
document.write("<script type=\"text/javascript\" src=\"writeload2.js\" charset=\"utf-8\" ><\/script>")
 
The source writeload2.js contain:
document.write("<p>loaded from writeload2</p>")
 
When refresh test.html the content is updated each time I change writeload2.js injected with document.write.
The same behavior is in Chrome, whether I use Disable Cache or not.
 
(I don't use php, it's tested via node.js. And your example, could be more more complex.)
 
I assume the problem will be more in the definition of your server-side HTTP headers. See and check header Cache-Control definition.
E.g. max-age can cause that the browser does not check the ETag of the modified file.
If you have set HTTP Response as Cache-Control: public, max-age=3600, it takes hour to browser reload source file.
 
I have other tips:
  • try to use debbuging of embedded chromium browser through CEF_DEBUG_PORT
  • if possible, avoid to use document.write (e.g. createElement instead that) - see 'Intervening against document.write()' and docu
  • prior to HTML5 i see somthing like <META http-equiv=Cache-Control content=no-cache,no-store,max-age =0> (but I think it should be solved on the server side)

BTW: to suppress the Cache of embedded browser, could be probably use the --disable-application-cache flag, but I'm convinced that PTC does not allow (accessible) to configure the startup attributes of the zbcefr.exe Chromium process.
Use the CEF_DEBUG_PORT debug system and watch the HTTP headers of files.

 

Good luck

PZ

Mat
13-Aquamarine
13-Aquamarine
(To:zemanekp)

Thanks,

tweaking "Cache-Control" did the trick.

 

 

Top Tags