Tab Lock
-
This is a mod for a feature request ☛ https://forum.vivaldi.net/topic/25070/locking-pinned-tabs
The script will throw a popup as soon as navigation is being attempted.
It blocks
- reload
- going forward or backward in history
- opening links in the tab
- opening bookmarks in the tab
- quick commands navigation
- address field navigation
- search field navigation
It doesn’t block
- reader mode
- ajax navigation
// Tab Lock // version 2021.9.0 // https://forum.vivaldi.net/post/241508 // Custom page action. Throws a warning when you try to navigate. (function () { window.addEventListener("beforeunload", (event) => { event.preventDefault(); event.returnValue = ""; }); window.addEventListener("popstate", () => console.log("block navigation")); })();
Create a new file with a text editor, paste the code and save the file to the application's
user_files
folder. Of course the file will disappear on update (just likecustom.css
andcustom.js
), but you can add it to your batch script if you're running one of those. Directions how to set up a batch script for patching Vivaldi are available on this forum board (pinned topics).You can also download the file directly from github, if you don't want to create it yourself.
Nowadays we can use a command chain to both toggle the pinning of the tab and locking it (page actions are part of command chains). To do so create following chain:
- Pin/Unpin Tab
- Tab Lock
The chain can be used from quick commands, as keyboard shortcut, as mouse gesture, or as a menu entry.
-
Cool, this is the 1st of this kind of mods I see.
I've added both versions, also a New_Tab_Always.js, and they work nice.
Interesting that Vivaldi adds the file name of the script in the actions menu so there's no need to set how it should appear in the menu inside the script itself. -
@ian-coog Page actions are handy, I've been running all sorts of weird scripts in there. And yeah, not only is the entry creation automatic, the script execution is as well.
-
Locking tab script looks promising, but how do you set up page actions? I have them on in Settings.
-
@bolling1969 the icon "<>" in the status bar
-
@bolling1969 That's a good point I have overlooked. An alternative way of activating a page action is quick commands
vivaldi://settings/qc/
-
You had it in your screenshot, I was just looking in the wrong place for page actions. I created LockFileMod.js and saved it in C:\Users<User>\AppData\Local\Vivaldi\User Data (Windows 10) but no luck. I'll do more research on page actions.
-
@bolling1969 it's in
"C:\Program Files\Vivaldi\Application\2.1.1322.4\resources\vivaldi\user_files"
look in help/about your Executable Path and then go in "Application\2.1.1322.4\resources\vivaldi\user_files" from there.
2.1.1322.4 of course is the version I'm using, you might have a different one. -
Thanks. I found it. It works as expected. Expect it can't do what I hoped. I have a work page that has to be in IE for security purposes. I use IE Tab within Vivaldi as I can't stand IE. Unfortunately, Page Actions can't apply to the IE Tab page.
-
@bolling1969 said in Tab Lock:
I have a work page that has to be in IE for security purposes.
what does that mean, "IE" and "security purposes" sounds like a joke to me
the page detects the browser, or simply doesn't work outside IE because it uses something other browsers can't do, like, Microsoft specific html?
Try with a User Agent Switcher and see if it works anyway inside Vivaldi -
@bolling1969 Yeah, I tried it out. I'm sorry, but I don't know how to work around it, literally nothing works on this kind of simulated browser tab.
-
I often reload one tab what I'd like to open all links in new tab, but after reloading it your extansion doesn't "reload". Any idea?
-
@potmeklecbohdan Hmm, I have no idea what you have in mind. But I can tell you following:
- A page action is being injected when it is selected in the dropdown, or when it is triggered with quick commands
- A reload of the tab won't remove the page action, it is simply being injected again, because the option is still selected.
- To remove a page action you have to either deselect it in the dropdown, disable it with quick commands, or close the tab. On removal of the page action the tab will reload, if it's still there.
-
@luetage Hmm, I
- select "New Tab" in page actions (that's your new tab version)
- (click any link)
- reload the page
The "New Tab" action is still selected, but links open in current tab. The same with your "default" mod for disabling links.
-
Oh, now I get it. This shouldn't happen of course. But I can't reproduce it. I just enabled tab lock on the forum, which disabled all links. After reloading links are still disabled when I click them. Could you take a look at your status bar and check if tab lock is still selected after you reload?
-
@luetage Yes, it is.
-
@bolling1969 said in Tab Lock:
I have a work page that has to be in IE for security purposes.
what does that mean, "IE" and "security purposes" sounds like a joke to me
the page detects the browser, or simply doesn't work outside IE because it uses something other browsers can't do, like, Microsoft specific html?
Try with a User Agent Switcher and see if it works anyway inside VivaldiWhat I probably should have said was that I have pages I use at work that are poorly coded and don't display properly outside of IE. Anyway, enough on that here, I don't want to steer the topic down a side course.
-
@luetage Found the problem. All JS actions don't work after reloading the page.
-
@potmeklecbohdan I tested both Tab Lock and Skewed Images now. Both work after reload for me. The issue lies elsewhere. What operating system do you use? And more importantly, do you have some kind of adblocker blocking javascript? This would explain why the code is gone from the page after reload…
In any case, more people should test this, then we will find out what's going on.
Just for the record, I'm on macOS using latest snapshot (2.1.1322.4)
-