• Resolved klingbeil

    (@klingbeil)


    Hello,

    I share my forms through iframes with other sites. I would like to do the following: I want to create a link within the form that directs to https://www.xxx.com with the text “abc”.

    However, when someone embeds the iframe code and loads the form on their site, I want the link to be created outside the form on the host site’s page. In other words, I want to create a nofollow, external link on the host site that is independent of the iframe form, not a link visible within the iframe itself.

    Thank you.

    <iframe id="xxx" src="https://www.xxx.com/?cff-form=15" style="width: 100%; height: 2581px; overflow: hidden; border: none;" scrolling="no"></iframe>

    Notes: The code for creating a form is not the iframe code I shared.

    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.

    • This topic was modified 6 months, 3 weeks ago by klingbeil.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    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 6 months, 3 weeks ago by codepeople.
    Thread Starter klingbeil

    (@klingbeil)

    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.

    Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter klingbeil

    (@klingbeil)

    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.

    Plugin Author codepeople

    (@codepeople)

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating Links’ is closed to new replies.