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! |
|
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> |
|
No worries for the response time, we're also useless at responding ourselves. I mostly just do this in my dwindling free time. Thanks so much for this contribution @kenduguay1. Love that we can now automatically set this content via JavaScript. |
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
publicdirectory to demonstrate the intended use.