![]() On the receiver window the postMessage() trigger a message event where you can get the data like this: window. PostMessage used incorrectly could potentially make your website vulnerable for crosssite-scripting attacks. For this, you can use the window.open() return value or in case of an iFrame the contentWindow property. The window.postMessage () method enables cross-origin communication between a window object and an embedded iFrame and therefore provides a mechanism to circumvent this restriction. To send a message first, you need to get a window reference or an iframe instance where you will post your data. This results in a more seamless navigation experience where you can quickly switch between dashboards without reloading the page. To send a message first, you need to get a window reference or an iframe instance where you will post your data. The postMessage () Method This method has two main parameters: message a string or object which is our data, targetOrigin the URL where we send our message. When embedding SharpTools.io dashboards within in an iframe, you can use the postMessage API on modern browsers to perform client-side navigation of your embedded SharpTools.io dashboards. targetOrigin – the URL where we send our message.message – a string or object which is our data,.Need a reliable web application developer? We can help you achieve your goals with Laravel and Vue.js. With this trick, I were able to catch the iFrame load end and so on. ![]() I’ve used it for an advertisement solution where were the embedded iFrame banners had to communicate and send a message to the main window – where the ad script ran. The use cases for this methodology is unique. Using this function, you can quickly get around the mixed origin problem safely because you can send the data to the correct location and then make all your processing on the same origin without any related error. With postMessage(), you don’t need similar protocol, host or port to send a message to other domains code. If you want to send a cross-origin request, you need to set up your PHP headers on the receiver side to enable this type of cross communication. This is a JavaScript solution, so it works on the client side. postMessage - send messages between iframes and windows -, postMessage, Ive heard nothing yet, Code used in this page, view source print 01. It is something you also make with simple AJAX request, but here there aren’t classical cross-origin restriction. ![]() ![]() With the use of postMessage() method, you can communicate between different windows or iframes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |