Hello @klingbeil
I’m sorry, but I don’t understand your explanation:
>>> For example, I uploaded the iframe code to the ABCD site. When the form is loaded onto the ABCD site, it should create an additional nofollow link on the ABCD site outside of the form. However, this rule must be implemented directly within the form using JavaScript code, not through the iframe.
If you want to pass a link to the form via its URL you can do something similar to:
<iframe id="xxx" src="https://www.xxx.com/?cff-form=15&link=https%3A%2F%2Fwww.abcd.com%2Fpage'" style="width: 100%; height: 2581px; overflow: hidden; border: none;" scrolling="no"></iframe>
I’m passing the link parameter with an URL to the https://www.abcd.com/page page
Now in the form, you can insert an “HTML Content” field with a DIV in its content where display the link
<div class="link-container"></div>
<script>
var link = getURLParameter('link', '');
if(link) document.getElementsByClassName()[0].innetHTML = '<a href="'+link+'" rel="nofollow">Go to the page</a>';
</script>
Best regards.
-
This reply was modified 1 year, 9 months ago by
codepeople.
Hello,
Currently, the sites where I share the iframe are using the code, so I cannot modify the iframe code. As a result, I cannot add a link to the end of it.
In short, I want to create a link using JavaScript within the form, but when the other site calls it with an iframe, I want it to create a nofollow link on the target site, independent of the iframe.
Hello @klingbeil
If both pages, target website and page loaded into the iframe belongs to different domains, you cannot get the target URL from the iframe content due to same-origin policy restrictions of browsers.
Best regards.
Do you have any suggestions? When we create a link from within the form using an iframe, it does not get included in the source code of the other site. This doesn’t solve the issue either.
Thank you.
Hello @klingbeil
An alternative would be to create the iframe at the runtime, and give your clients the URL to a javascript file.
Something similar to:
// Create a new iframe element
const iframe = document.createElement('iframe');
// Set the attributes of the iframe
iframe.src = 'https://www.xxx.com/?cff-form=15&link='+encodeURIComponent(document.location.href);
iframe.style = 'width: 100%; height: 2581px; overflow: hidden; border: none;'
// Append the iframe to the body
document.body.appendChild(iframe);
The previous code has created the iframe dynamically and passed the target website’s URL as parameter.
Please note these questions are not about our plugin, they are specific to your project. The plugin support does not cover implementing the users’ projects. If you need a developer to implement your project, contact us via the plugin website. Contact us.
Best regards.