-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Push input through postmessage #1992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add handler for message events
3211a38
to
7710c5e
Compare
This is a cool feature that I hadn't thought of before! Seems good to me. As a niche thing, could we change the postMessage format to be:
This aligns with popular libraries like redux. Plus, it mirrors the internal function call we're doing, so people have to remember less names for things! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes in other comment.
My apologies for not getting back to you sooner, I missed the notification from GitHub. I am happy to make the change, I should have time to work on it next week. |
…1/CyberChef into push-input-through-postmessage
I have made the requested changes to the postMessage format. Here is an updated html example. <!doctype html>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<iframe src="http://localhost:8080/", title="cyberchef", height="500px", width="70%", id="chefFrame">
</iframe>
<br>
<button onclick="pushToChef()">Test</button>
<input type="text", id="dataInput">
<script>
function pushToChef() {
data = $("#dataInput")[0].value
target = $("#chefFrame")[0]
target.contentWindow.postMessage({
"id": "setInput",
"value": data
})
}
</script> |
Feature to allow pushing the input value to chef via a postMessage. This allows other websites to integrate with CyberChef by loading CyberChef in an iframe and setting its input data.
The following html can be placed into a file in the
public
directory to demonstrate the intended use.