Welcome Guest Search | Active Topics | Sign In | Register

Disable "Block third-party cookies and site data" Options
ozheek
Posted: Saturday, May 5, 2018 6:36:05 PM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Hello,

I am getting an error when trying to redefine window.localStorage.

If found that I need to disable "Block third-party cookies and site data" option.

https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document

How to do it in EO.Browser?

I used next Chromium switches, but it won't help me:

--disable-web-security --allow-file-access-from-files --reduce-security-for-testing --noerrdialogs --allow-cross-origin-auth-prompt

eo_support
Posted: Tuesday, May 8, 2018 3:04:27 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

You do not need to do anything particular to enable localStorage. So it should just work and it is not necessary for you to pass any command line arguments. For example, you can try to use our TabbedBrowser sample application to browse this Url:

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_localstorage

And it should work the same way as Google Chrome.

If you continue to have problem, please try to isolate the problem into a test page and send the test page to us:

https://www.essentialobjects.com/forum/test_project.aspx

Once we have that we will be happy to investigate further.

Thanks!
ozheek
Posted: Tuesday, May 8, 2018 7:38:09 PM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Hi,

Thank you for the answer!

localStorage works fine, but I want to see all changes in localStorage, so I did:

Code: C#
webView.JSInitCode = GetLocalStorageCode();


And GetLocalStorageCode has the function that redefines the localStorage:

Code: JavaScript
Object.defineProperty(window, 'localStorage', {
    configurable: true,
    enumerable: true,

    value: {
        getItem: function (sKey) {
              return "Hello";
        },
        setItem: function (sKey, sValue) {
             console.log('localStorage changed');
        }
    }
});


or simple way:

Code: JavaScript
window.localStorage = function () {};


Any changes on localStorage are blocked. I found on Chromium project that block can be disabled in Chrome, but I didn't find how to enable changes on localStorage using EO.Browser: https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document

I've tried different ExtraCommandLineArgs, like --disable-web-security, --allow-file-access-from-files, --reduce-security-for-testing. It won't help, I still can't change the localStorage.

Hope you can give any ideas that may help.


eo_support
Posted: Thursday, May 10, 2018 2:38:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
I do not believe you can do this with Chrome either. You can try your code with Google Chrome and it won't work. It may not give you an error message, but window.localStorage is not replaced either.

The link you provided has nothing to do with modifying window.localStorage object. It has to do with modifying contents in the local storage.
ozheek
Posted: Sunday, May 13, 2018 5:02:15 AM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Thank you for the answer!

I have tested it on my Chrome and it works perfectly. You can check it with your Chrome as well.
I created the script here https://codepen.io/anon/pen/ELRWXx

Screenshot of my results: http://prntscr.com/jh8bxu
eo_support
Posted: Monday, May 14, 2018 2:05:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Which version do you use? We tested your code with the latest build and it seems to work fine (showing "Any key will return the same value").
ozheek
Posted: Monday, May 14, 2018 2:10:06 PM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Thank you for the fast answer!

I use 16.2.93. It looks like the issue that I have the old version. Is it possible to redefine localStorage with my version?
eo_support
Posted: Tuesday, May 15, 2018 3:33:04 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Chromium is a huge project and we can not confirm or investigate about whether each version supports a specific feature. Since our product is directly built from Chromium's source code, usually if it doesn't work, it means your version does not support it.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.