How can I get query params in a custom N8N node embedded in an IFrame? Example:
let u = new URL('http://ex.org?p=val'); console.log(u.searchParams.get('p'));
How can I get query params in a custom N8N node embedded in an IFrame? Example:
let u = new URL('http://ex.org?p=val'); console.log(u.searchParams.get('p'));
hey, try accessing the node’s incoming data. sometimes the node gets the full url from which u can extrac the params manually. hope this tips helps
I encountered similar challenges when embedding a custom N8N node in an IFrame. In one instance, I had to rely on an alternative approach by processing the incoming HTTP request at an intermediary server, formatting the parameters, and then forwarding them to the custom node. This ensured that query parameters were not lost when standard browser methods were unavailable. Another approach involved verifying that the hosting environment correctly transmitted the full URL to my node. Both methods required additional handling, but they ensured consistency and improved the overall reliability of parameter extraction.
In my experience working with N8N, I found that leveraging postMessage for communication from the parent to the embedded node was quite effective. Since the browser methods aren’t accessible, I set up an intermediary that sends the query parameters alongside other necessary data to the custom node, which then reads the message data and processes the parameters. This approach required modifications in both the host and the custom node, but it reliably captured the required information even within the IFrame context and bypassed browser limitations.