klionlists.blogg.se

Firefox gbrowser postmessage
Firefox gbrowser postmessage







firefox gbrowser postmessage
  1. #Firefox gbrowser postmessage full
  2. #Firefox gbrowser postmessage windows

The last example is what I will be using in my solution more on that later.

firefox gbrowser postmessage

The window sending the event obviously need a reference to the receiving window.

#Firefox gbrowser postmessage full

While it doesn’t provide full access to another window’s model, it gives us a framework to establish communication. Introduced a few years ago in Firefox and now supported by all major browsers, postMessage allows documents to communicate with each other through their containing window instances. How could I query the other window to see if it was already loaded? I found the answer in Window#postMessage. Likewise, the child window could not talk back to the parent window through the window.opener property. Accessing those properties would always log errors and return undefined regardless of if the child window was properly loaded or empty because the second application was on separate domain. Unfortunately this was where I ran into the cross-domain access issue. “I’ll just detect that situation by checking the child window location property or its document.URL if they were undefined, I could call window.open again, but this time pass in the real URL to load.” But now if the child window did not exist it will be created with no content! You can prevent this by passing null as the URL parameter. Why was this a problem? Because calling with a URL WILL load it, even if the child window exists and is already displaying that URL. This functionality could easily be fulfilled by calling the window.open method with a targeted window name, except for an additional criteria if the child window was already open we did NOT want it to reload the page as this would trigger other events on our server! It was required that navigating to a path on one application would automatically launch a child window opened to a page in the other application, or reuse the same child window if it already existed. We were working on two applications with feature-rich thick clients that were on different domains. I recently faced the following dilemma on a project. Sadly, this also prevents any communication between thick-clients of web applications that do know of and trust each other … unless they use the method introduced in HTML5.

#Firefox gbrowser postmessage windows

However, cross-domain interaction is also blocked on the client-side browser windows loaded with different sites have limited access to each other in order to prevent security breaches. We’ve previously covered how JSONP and CORS allow thick-client web applications to circumvent the same origin policy preventing requests to servers in different domains.









Firefox gbrowser postmessage