Local storage event listener not working in Firefox - firefox

I have a sandbox iframe which is hosted by various websites. Lets assume that this iframe is loaded like this:
'src="https://example.com/wie.js"' I have already added 'allow-scripts allow-forms allow-modals allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-storage-access-by-user-activation' at sandbox. I also use document.requestStorageAccess() from inside the iframe and I set event listeners for the storage like this:
window.addEventListener('storage', onStorageFunc, false);.
From the iframe a popup window is presented when user clicks a specific button and the popup opens at lets say at this url "https://paypal.com". After user navigation on popup, paypal at the end of the flow redirects user to this url "https://example.com/success". At this point when user is navigated to /success I add some data to local storage which I expect to trigger the storage event listener and the onStorageFunc to run.
This doesn't happen, while in other browsers it works as expected.
Since both popup and iframe are under the same url (https://example.com) and I have used requestStorageAccess, I would expect this to work normally. Can you please help me to find out what is going wrong here? In the past I had the same problem but it was fixed when I added 'requestStorageAccess' and 'allow-storage-access-by-user-activation'. Now I can see it happening again.

Related

I can just view my website locally through IP on mobile but buttons are not working like saving data etc

view page
My client want to use a website on Android mobile but he doesn't want online. He just wants to access it within a network, but my problem is that some buttons are not working like the save button used for to save data, and the reset button to reset all fields.
I am using codeignator with xampp
I think you can run your program on your browser by internal IP to debug.
You can use the inspector of browser to check console if any error like javascript or php things happen when you click submit or reset

How to do ajax loading with URL change but not page redirection?

If you carefully notice facebook, you will understand that the when you visit one page to another then the whole page is not refreshed or redirected but the URL changes when navigating to new page. It is more clear when chat windows are open, they remains static during page loading. As other website does this by using the # but facebook does not.
There is another example came to me: http://www.davidwalsh.name/. Visit the site and open other pages within their site and you will understand what I mean. Don't forget to notice the URL change.
How they do this?
Added More: I want a way that the page content will be loaded with ajax, change the URL for bookmark feature but when changing URL it should not reload / refresh the page by not using # (hash).
You have two questions:
For the URL change you can put the path instead of the # in the href property of the anchor (e.g /otherlink).
For opening the chat or opening some div does not require to send it in the url, its the onclick event on the div and its expands. Also the chat remains open may be thay set cookie or flag when the chat is first time opened and checking and changing the chat with flag they are setting.
As suggested by #andytuba
For Facebook, Google "hash navigation ajax".
For DavidWalsh, google "history API".

How does Facebook handle requests between Home page and Profile page

I am just wondering how facebook manage requests to "my profile page" and "home page" and some other pages that seem to reload just some content.
For example when I am on "my profile page" on facebook, i Hit the home button and the top bar button and chat panel on right side remain intact (they are not reloaded). I have monitored XMLHTTPRequest in webkit console and no ajax is generated, so its not Ajax (i think). Otherwise, if FULL http requests are generated when clicking those links, I thought the full page must be reloaded, I am right? So I have no clue how is this handled. Can you give me a hand please?
Thanks :)
It's a type of performance optimization called "quickling", they also use a "pagecache" strategy to reduce the data from server. In the lower level, it depends on javascript perform as a LinkController, which delegate a hyper-link click event and then send an ajax (or use iframe) to request the pagelet data from server, the response will be a json-formed data structure, then javascript will insert the content of current page. Uri in your address bar can be dealled with the hash change event in old browsers and H5's History API (pushState) to manage the history record of browser.

Browser OnLoad event handler

I have made an google chrome extension recently. It is working fine except that it works only when user clicks it. I want it to update status even if it is not clicked. So, there is any browser onload action so that I can start updating the status continuously using AJAX.
Thanks :)
Create a background page for your extension.
The background page is loaded as soon as the extension is enabled, so any code in your background page will get executed without needing the user to click anything.

JSF and browser back

I have a very strict requirement to use POST to pass in request parameters to my application upon entry. Once entering the application (page1), entering form information and continuing to the next page (page2) via a commandButton, the expectation is that the data will be posted and later read from a session scoped manage bean. All works well except when using browser back on page2 to navigate back to page1.
I have tried adding a redirect tag on the navigation rule that navigates from page1 to page2 to no avail. I have also tried this implementation of the Post-Get-Redirect pattern (http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html). Am I missing something obvious here?
Abel, the scope of page1 is request.
The solution we came up with which is no means ideal is to disable browser caching on the previous page. What this means is that whenever you refresh the page using the browser refresh button or click the browser back button, the browser will indicate that the page is expired and prompt a warning asking whether you want to re-submit the request.
We do have a work around which is to provide navigation buttons within the webpage but the idea was to support browser back. This would be easy using GET parameters, but POST provides additional complexity which we have decided to mitigate by by providing our in-house navigation buttons.

Resources