Jump to content

Help me to make a function : block and allow firefox cookies on site


Recommended Posts

I want to block cookies on some site, but i dont know how. I try to open FFex.au3 and see this function

Func _FF_EmptyCookies()   
_FFCmd('Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager).removeAll();')    
If Not @error Then  Return 1    
Return 0 
EndFunc   ;==>_FF_EmptyCookies

Please help me make a function to block and allow cookie on site:

Ex: _FF_BlockCookies($site) and _FF_AllowCookies($site)

Link to comment
Share on other sites

I want to block cookies on some site, but i dont know how. I try to open FFex.au3 and see this function

Func _FF_EmptyCookies()   
_FFCmd('Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager).removeAll();')    
If Not @error Then  Return 1    
Return 0 
EndFunc   ;==>_FF_EmptyCookies

Please help me make a function to block and allow cookie on site:

Ex: _FF_BlockCookies($site) and _FF_AllowCookies($site)

Depending on the informations there:

https://developer.mozilla.org/en/nsICookiePermission

you can made something like this:

; $iAccess:
;           0 = ACCESS_DEFAULT
;           1 = ACCESS_ALLOW
;           2 = ACCESS_DENY
;           8 = ACCESS_SESSION
Func _FF_CookiesSetAccess($sURL, $iAccess)
    If __FFCheckURL($sURL) And ($iAccess = 0 Or $iAccess = 1 Or $iAccess = 2 Or $iAccess = 8) Then
        _FFCmd('Components.classes["@mozilla.org/cookie/permission;1"].getService(Components.interfaces.nsICookiePermission).setAccess(Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI("' & $sURL & '", null, null),' & $iAccess & ');')
        If Not @error Then Return 1
    EndIf
    Return SetError(1,0,0)
EndFunc
;===============================================================================
Func _FF_CookiesDeny($sURL)
    Return _FF_CookiesSetAccess($sURL, 2)
EndFunc
;===============================================================================
Func _FF_CookiesAllow($sURL)
    Return _FF_CookiesSetAccess($sURL, 1)
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...