• Resolved kwright

    (@kwright)


    Hi,

    I have a url which ends with /?param_name=xxxx where xxxx is a number.
    When I use the Twitter Button it does not display the /?param_name=xxxx

    I have added this to the Additional JavaScript area:

    a2a_config.templates = {
    twitter: "#Skills ${title} ${link} by @SkillBoxes"
    };

    How can I modify this so that the ${link} includes /?param_name=xxxx?
    Or is there a better way to achieve this?

    Thanks for your help
    Ken

    https://wordpress.org/plugins/add-to-any/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author micropat

    (@micropat)

    If a page’s current URL already includes those parameters, then you can manually place the buttons PHP code in your theme as suggested here.

    Otherwise, you can write some JavaScript that uses AddToAny share event handling (see “Modifying the share”) to modify the shared URI and add your parameters as needed.

    Thread Starter kwright

    (@kwright)

    Hi Thanks for the quick response and suggestions.

    But I don’t think this solves the problem I have.
    The /?param_name=xxxx? is a dynamically generated from a Formidable Pro Form. So one time it could be: /?param_name=1234 and the next time /?param_name=4321 and do on each pointing to different details from a Form.

    So I really need the Twitter Button to read the whole line:
    e.g. http://www.somesite.com/page/?param_name=1234 (reading the whole URL) but the button does not do this … it only reads http://www.somesite.com/page

    I am not strong on JavaScript but it looks to me like I need to find a way for the button “snippet” to read the whole line being displayed in the Browser.

    Thanks
    Ken

    Plugin Author micropat

    (@micropat)

    If those parameters are in the “current URL” (the URL in the browser’s address bar), then just have AddToAny share the current URL as the PHP code here does (Twitter templates will use that URL, too).

    If those params are not in the current URL, you’ll want to look into making that generated URL available in JavaScript as a global variable. The global variable will ultimately look something like this when you view a page’s HTML source:

    <script>
    window.my_generated_url = 'http://www.somesite.com/page/?param_name=1234';
    </script>

    Then you can access that global variable (window.my_generated_url) within your AddToAny share event and change the shared URL.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘JavaScript area is not getting full URL – Problem’ is closed to new replies.