Skip to main content
Topic: Clear history when application closes? (Read 2182 times)

Clear history when application closes?

    I am using the weekly 170 for WinXP (legacy QtWebkit) in the portable mode and have the following issues:

    • The visited links seem not to change color when in private mode. Maybe it is the Webkit, or maybe something could be done about it.
    • When not in private mode and the following options are checked: "Remember browsing history" and "Clear history when application closes" (and also "Clear browsing history" for the last "6666 h" in Clear history options), I still see the previous history after restarting Otter. This looks as a bug to me.

    On this occasion a three tiny wishes:

    • Could perhaps the options dialog retain its current tab between invocations during the same session?
    • Could perhaps an option exist which, when checked, would mean that each new tab (when explicitly created) would open with a home page? This was not a possibility of Opera 12.18, but I find it very useful for those who, like me, have the bookmarks actually in the local home page, in order to be browser independent. (It is a feature of the K-Meleon.)
    • Could perhaps - besides the existing tab popup menu item "Clear Other Tabs" - the following two menu items exist: "Clear Left Tabs" and "Clear Right Tabs"?


Thanks and best wishes!
Borut

Re: Clear history when application closes?

Reply #1
  • The visited links seem not to change color when in private mode. Maybe it is the Webkit, or maybe something could be done about it.
We don't have control over that, currently QWebHistoryInterface has only global instance and it's up to WebKit to decide what to do in private mode.

  • When not in private mode and the following options are checked: "Remember browsing history" and "Clear history when application closes" (and also "Clear browsing history" for the last "6666 h" in Clear history options), I still see the previous history after restarting Otter. This looks as a bug to me.
Indeed, I'll check that.

  • Could perhaps the options dialog retain its current tab between invocations during the same session?
I might comsider that.
Note that current plan is to replace it by Firefox like page, and they seem to not remember last index.

The other two wishes sounds like a material for extensions.

In fact you can already get home page as default page by adding simple User Script matching about:blank and disabling Start Page:

Code: [Select]
// ==UserScript==
// @name Redirect on about:blank
// @version 1.0
// @author Emdek
// @description
// @include about:blank
// @noframes
// ==/UserScript==

window.location.href = 'https://otter-browser.org';

Update:
I can confirm only issue with clearing on exit (delayed save gets interrupted...), are you sure that you checked browsing history when clearing manually?
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: Clear history when application closes?

Reply #2
And now it's fixed in master.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: Clear history when application closes?

Reply #3
Many thanks for such a fast action. Regarding clearing history: It has always worked on explicit clear. Only implicit clear on exit was a problem. As I understand you got that and I am eagerly awaiting the next week binaries.

I have a bit of a problem with the script though. I apologize for my newbieness: I have disabled the StartPage in about:config. I have created a script file (currently directly in a subdirectory of the ./profile/scripts), activated it and it seems to work. However, I am trying to bring it to show a local page, but in vain. I tried something like 'file:///C:/...', or 'file://localhost/C://' and what not... Is it at all possible to access a local file here (due to sandboxing), or, what am I doing wrong?  I do not have a local server (and I use Otter portably on different machines).

BTW, while trying scripts, checking, unchecking, reloading it in GUI, it seemed to me that a restart of Otter was always necessary to make it work (when it worked, i.e. when using the http protocol).

Sorry on taking your time with trivia. Thanks!

Re: Clear history when application closes?

Reply #4
Only implicit clear on exit was a problem. As I understand you got that and I am eagerly awaiting the next week binaries.
Ah, I misread then, I guess.

I tried something like 'file:///C:/...', or 'file://localhost/C://' and what not...

Paths under Windows are always "fun".
Try simply C:\, but it might indeed get blocked as attempt to access local file system, check what is shown in Error Console (Ctrl+ Shift + O).
You could try another approach, especially if you are not accessing images or other resources from disk (but that too could be worked around using data URI, but that could be time consuming), simply setting page content from JS.

If you have edited file without reloading it using context menu then it will continue using cached version, right now we don't track on disk changes.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: Clear history when application closes?

Reply #5
Your answers were eye openers for a few things for me - thank you for that!

When trying to simply assign a local file to window.location.href it indeed got blocked (as you thought it would be) and this was nicely shown in the console (Ctrl+Shift+O).

Explicit script reloading (via popup) indeed seems to work - obviously it was my handling error before. However, with checking/unchecking I am not sure if there was any effect. (Never mind, it is of no importance.)

So, then I decided to try a completely another solution and use a web server. I believe that it will still be portable enough for me. Sure, on the first start the system security asks if the server application should be allowed to do the job, but I believe and hope that this will in general go well for me. On my own laptop it is working superbly.

If anyone is interested, I am using the following two free applications for this:
TinyWeb as server - https://www.ritlabs.com/en/products/tinyweb/
PStart as application launcher - http://www.pegtop.net/start/ (for almost 10 years I am very happy with it - works well on 32bit WinXP and Win7, most probably also on newer ones).

Many thanks once more!

Update 2017-04-08 06:50:

Now my home page is being shown not only when I explicitly want to open a new empty tab, but also always when a new tab is being created, i.e. for instance when I right click a link and then "Open in New Tab", or "Open in New Background Tab". Instead of showing the wanted page in it, I get my home page.

My guess is, that about:blank is being shown first, and as soon as it happens, the script runs, so that real target page never shows up. Can something be done? As far as I can tell, the K-Meleon shows in such cases the page from the "launching tab" in the new tab (instead of the blank tab), for as long as the real target page is being fetched.

Re: Clear history when application closes?

Reply #6
@Borut, yeah, I've noticed that (original version of that script simply set background to blue for debugging purposes), I'm investigating it.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: Clear history when application closes?

Reply #7
Thanks for 171. I can confirm that history is now being cleared on exit. Also full screen mode is working fine again. The above described issue with opening new tabs when following links is still there, so let us hope that in some time it will be clear what happens and it will be possible to change it.

Many thanks for developing Otter - for quite a large percent of my daily browsing I am able to happily use it.

A small question: I am/was new to user scripts. Could you perhaps point me to a good source of knowledge, maybe not so about JS itself, but more about the binding to the browser events (as was here the case of loading about:blank)?

Re: Clear history when application closes?

Reply #8
@Borut, yeah, still working on that, I've done initial research but it didn't uncover how exactly it gets triggered yet.

Perhaps you could start here:
https://developer.mozilla.org/en-US/docs/Web/API/Event
I'm usually using MDN myself when in doubt.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: Clear history when application closes?

Reply #9
@Borut, I've analyzed that about:blank issue and proper fix will require changes in how we are handling requests to open new tab, but there seems to be also a way to apply quick fix, by preventing history clearing when WebWidget::getRequestedUrl() is not empty.
I'll try this approach for weekly 173.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.