'function navigate() { document.getElementById

I am having an issue trying to figure out how to add custom code to a URL that when clicked, it reloads an iframe on the page. I only have access to the URL.

iframe ID = gfgFrame

function navigate() { document.getElementById("gfgFrame").src = "/ClientCommunity/s/all-products?fileInfo=abcXyz";}

URL: javascript:navigate()

How can I add the above directly to the URL instead of using the javascript:navigate() ?



Solution 1:[1]

If your iframe has a name attribute you can just make an anchor with target="theIframesName"

<a href="/ClientCommunity/s/all-products?fileInfo=abcXyz" target="gfgFrameName">click</a>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 James