Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name localhost iframe script
- // @namespace http://localhost
- // @include http://localhost/
- // @version 1
- // @grant none
- // ==/UserScript==
- alert("testno na localhost!");
- 'allow pasting'
- /*
- * In window A's scripts, with A being on <http://www.nepremicnine.net:8080>:
- */
- var popup = window.open("", "", "width=200, height=100");
- // When the popup has fully loaded, if not blocked by a popup blocker:
- // This does nothing, assuming the window hasn't changed its location.
- popup.postMessage("The user is 'bob' and the password is 'secret'",
- "https://secure.nepremicnine.net");
- // This will successfully queue a message to be sent to the popup, assuming
- // the window hasn't changed its location.
- popup.postMessage("hello there!", "http://localhost");
- function receiveMessage(event)
- {
- console.log("GreaseMOnkey script");
- // Do we trust the sender of this message? (might be
- // different from what we originally opened, for example).
- if (event.origin !== "http://localhost")
- return;
- // event.source is popup
- // event.data is "hi there yourself! the secret response is: rheeeeet!"
- }
- window.addEventListener("message", receiveMessage, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement