Sign in to follow this  
Followers 0
vietnam929

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

3 posts in this topic

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)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thank you so much

Edited by vietnam929

Share this post


Link to post
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
Sign in to follow this  
Followers 0