how to delete cookies in firefox 3.5+ using an extension? - javascript

i've got a problem:
i need my extension for firefox 3.5+ to delete cookies. all cookies of my firefox.
example: i've serfed net, got some cookies installed on my pc by the sites i've visited. and i want my extension for ff to delete all these cookies.
could u please show me the direction where i can find an answer for my question? (or and it'll be the best, give a link to a code sample)
and one more: can i do this in javascript or i must use c/c++ and napi?
p.s.\i do not need an extension like close'forget, i want my own extension been able to do this work.
thanx for u'r future answers and sorry for my bad english...got no speach practice for a long time=(

From https://developer.mozilla.org/en/Code_snippets/Cookies , you just need to do the following in privileged javascript (i.e., inside a Firefox extension):
Components.classes["#mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager).removeAll();
If you want to do this without writing an extension, just go to options (Tools->Options on Windows, Edit->Preferences on Linux, Firefox->Preferences on Mac) and see the "Privacy" tab.

Related

Allow Firefox AddOn to focus window

I'm trying to write a Firefox AddOn that allows the user to quickly bring a specific open window to the front. While doing research on how to focus windows, I learned that browsers heavily restrict this to avoid misuse. Which I totally support if it is not intended by the user. In my case the user would install the AddOn to explicitly have this functionality, so focusing windows would be intended by the user.
The classic way to do this is Window.focus() but even the Mozilla docs say, that the success of this operation depends on the configuration of the user's browser.
Makes a request to bring the window to the front. It may fail due to user settings and the window isn't guaranteed to be frontmost before this method returns. - Source
In my browser (Firefox 94 on Ubuntu) it doesn't work.
I also read that setting dom.disable_window_flip to true in about:config will enable Window.focus() but it didn't - and it wouldn't be a feasible approach for an AddOn.
Firefox AddOns use a permission system and my expectation would be that there must be a permission that allows focusing windows for this specific AddOn. Unfortunately the permissions aren't very well documented and I couldn't find the right one via trial and error.
Most of the scarce information on focusing windows through AddOns that I found on the web was posted 5 to 10 years ago and doesn't work anymore.
I tried several approaches like calling browser.windows.update(tabId, { focused: true }) from the popup script (which I have a different issue with). I also tried to inject a content script that calls Window.focus() when asked to by a message from the popup script. None of those worked.
So my first question would be: is there any way today (2021, Firefox 94) to allow AddOns to bring a window to front?
And if so: can anyone please show me how?
Thanks in advance!
I think you need to name your window and then focus it.
const newWindow = window.open('http://....', 'NameOfTheWindow');
newWindow.focus();

Selenium Chrome Driver opens a different page than regular Chrome Browser

I'm trying to pull some information from this URL and ones like it: "https://www.rockymountainatvmc.com/tires-and-wheels/tusk-impact-complete-wheel-rear-p?s=1033997&v=1216"
My goal is to get the MSRP and other info for a specific part. To do this, I'm using python to run a selenium chrome webdriver that opens several of these URLs. The problem is the links aren't opening with the same information that I would get in my regular Chrome browser.
The link is supposed to contain all the information to "select a vehicle" and thus a specific part. When I open this in my regular chrome browser, everything works fine. When I open this using the automated Chrome page, it fails to select a vehicle and shows a general part page.
I can't figure out what the difference might be between these two browsers that would cause this. My regular chrome browser and the chromedriver are both version 81.0.4044.113. I've tried going to whatismybrowser.com and all settings are identical. Another interesting thing is opening this in internet explorer gives me the same result as the automated chrome browser. Help!
regular chrome browser
automated chrome browser
The Regular chrome browser is fetching the details of your bike(Something -- yamaha 125). It could be from past cookies or cache.
However, once you are opening it with Automation, a clean session s opened.
Try cleaning your cookies and cache on the browser(regular) and then try, both of them should appear same.
Or you can use options in chrome to select the profile your regular chrome browser is using. See https://startingwithseleniumwebdriver.blogspot.com/2015/07/working-with-chrome-profile-with.html.
Hope it Helps!

How to open Browser_Action from content.js? Is it even possible?

I am working on a chrome extension that allows users to open the browser_action by
pressing a keystroke that THEY have assigned from the options-page.
I would like to use document.onkeyup = function(){ Chrome.runtime.openPopup(); };
or something along those lines... I know that this Particular Extension API
(runtime.openPopup) only functions for mozilla firefox. I am building this extension
for Chrome & Opera so this is not an option for me.
How might I go about this? Would it be through adding chrome.commands API to
the manifest file; then modifying that file from options.html/options.js and reloading the extension? I've looked all
over for a way to do the method explained above and it doesn't seem
like that's possible.
Yes, Yes I know that Chrome has a built in method for customizing chrome extension
keyboard shortcuts, but like I said I want the user to be able to specify the
shortcut from the options.html page & I'm developing this extension for Opera
too. So that won't really work...
Any solutions?
I've tried Content.js--chrome.runtime.sendMessage
& Popup.js--chrome.runtime.onMessage.addeEventListener(function() {self.focus();});

Why do I have a message about "mxpnl.net" always in my Google Chrome console?

VM2335:34152 POST https://cr-input.mxpnl.net/data?_channel_id=&_partner_id=39571&_sub_id=0000&_app_version=1.0.23&_app=cs-dca net::ERR_INTERNET_DISCONNECTED
From what I can find, it appears to be a behaviour and analytic tracking script most likely related to mixpanel.com. I've recently run into the same thing, and followed it back to the content.js file inside the Tampermonkey chrome extension. I'm sure there are other chrome extensions that do the same thing, but uninstalling this chrome extension made the https://cr-input.mxpnl.net request stop.
I've also heard others have solved this problem by uninstalling Hide my adBlocker, but I can't confirm this myself.
This could mean you have a malicious Chrome extension installed. I googled "cr-input mxpnl" and came across this Google Forums post. If your internet is disconnected, the extension is probably failing to connect to the website where it wants to send your data.
To be clear, this is a guess. It may be a totally legit extension. However it would definitely be worth checking what extensions are installed, removing any that you don't recognise and doing a virus scan.
Since you are using some Adblocker extension that's the reason for getting
ERR_INTERNET_DISCONNECTED from the console. In the preferences of your Adblocker, you have blocked the access to Site Analytics Tracker
Turning off or Disabling the Web Statistic Tracker options from the preferences of the installed extension came from the Tampermonkey chrome extension. That alone stops accessing analytic tracking script most likely related to mixpanel.com.
There are other options from the preferences from the extension that might not be needed
Cheap Flights Advisor
PromoBar
Aliradar
So try to disable these options and always try to block all unencrypted requests by using HTTPS Everywhere extensions so that your information might not be stolen to any third party agents.

Detect operating system from Google Chrome Extension

I am developing a Chrome extension, and I need to detect which operating system Chrome is running on but i can't seem to find any info on how to do it. Please Help.
Thank You.
Recently added, you can use the getPlatformInfo method in Chrome's own API:
chrome.runtime.getPlatformInfo(function(info) {
// Display host OS in the console
console.log(info.os);
});
You would need to search for OS name and version inside window.navigator.appVersion.
If you just want to know a platform, see this answer. You can enhance the code by searching for other user agents.
Here is a detailed list of Chrome user agent strings (click on links to see what they mean).

Categories