I want to make a chrome extension which performs a certain action when the user enters the a "back" navigation action.
ie: they click the back button in the browser, or they swipe backwards with 3 fingers on a macbook pro, or if they enter the shortcut alt + left arrow.
How can I detect these actions? Should I create some type of listener or handler which accounts for each one individually?
You can use the webNavigation API.
Start monitoring the details for each transition type that you mentioned. And then try to do something with this information.
chrome.experimental.webNavigation.onCommitted(function(details){
console.log(details);
});
Related
I have a viewer instance where I programmatically activate the BimWalk tool as soon as it is loaded.
viewer.toolController.activateTool('bimwalk');
The BimWalk tool activates, but it doesn't seem like the BimWalk extension is aware of this. If the user presses the first person button [to turn off BimWalk], the tool "activates" again. Subsequent presses on the button do not seem to do anything and then the viewer is locked and the user cannot pan around.
Is there an alternative way to activate BimWalk that stays consistent with the toolbar button?
You're right, the Autodesk.BimWalk extension itself is keeping the state of the tool as well. Because of that you'll want to activate the tool via the extension:
viewer.getExtension('Autodesk.BimWalk').activate()
Then, clicking the First Person button in the toolbar will deactivate the extension and tool properly.
Is possible to intercept a click event on the chrome interface? I mean, not in the page that I'm visiting, but a click on a tab or a click on the "go back button", a click on the print button in the settings menu or a click on the "show all favourites button", ECC...
I cannot find anything useful in the APIs documentation.
The answer would be no, you can't directly detect the 'physical' button clicking event.
On the other side, you can listen to the request sent from the button. For example, when 'go back button' is clicked, it usually means the browser history is back, and you may refer How to Detect Browser Back Button event - Cross Browser for more info.
Please be aware that those methods may be tricky and may not be supported by every browser.
I use MVVM Cross in my UWP app. I noticed that if I call Close(this) in my ViewModel and the keyboard is open it will just close the keyboard instead of navigate back. I have to click another time to actually do the navigation.
This behaviour reminds me of the back button of the phone, where first the keyboard is closed and then the navigation is made.
EDIT: this seems only to happen when it's a view who contains a user control. When all code is directly in the view it works without problem.
Is there a way to tell MVVM Cross to just do the navigation? Or do I first have to be sure that the KeyBoard is closed?
I am developing a VOIP app based on the VoipChatterbox sample app project and I need to manipulate the headset button click.
I see that, during an active call, when I press the button on the earphone, I get a CallEndRequested event and I need to call NotifyCallEnded within 5 seconds.
But I need a different behavior for my app. I need to simply turn the microphone off / on (toggle behavior) when the user presses the headset button. (This requirement might seem odd, but that's what make sense in the context of my application). How can I achieve this behavior?
To summarize :
Is there any other event to understand that user has pressed the earphone button?
Is there a way to override the behavior that NotifyCallEnded should be called in five seconds when CallEndRequested event is fired?
For example, Adblock has a "turn off" option when you click the browser icon in the dropdown.
I would like users to be able to toggle on/off my extension for a domain, instead of having to disable it to turn it off.
Another option could be to put a static button on the webpage layout and have that toggle the extension or stylesheet on/off.
You need to add a 'browser_action' to the extension. You define it in the manifest.json as detailed here.
Use the onClicked event listener in your background script/page to disable/enable the application based on user clicks.
You can also use the same event handler function to make changes to the browser action icon or badge text to show the state change / current state to user.
Update Feb 2023:
When using manifest version 3, use action instead of browser_action. Details here.
you could try a mixture of local storage, a toggle in a popup, and conditional statements surrounding your code
Abraham, you could try and use this Chrome extension:
Link: https://chrome.google.com/webstore/detail/niemebbfnfbjfojajlmnbiikmcpjkkja
You can use it to quickle enable/disable all your extensions.
I found this extension on this website:
http://www.addictivetips.com/internet-tips/disable-all-extensions-in-chrome-with-a-single-click/
The article also mentions 2 extensions with which you can enable/disable an extension through a command in the URL box ("enable <>")