0

I tried, several times, to create a "save to foursquare button", but, maybe, there´s a problem with the script.

I tried this code, that works, from a website for the site venue:

<div class="locInfo vcard" style="display: none;">
    <h4>
        <a class="fn" href="">Flying Star Cafe - Menaul</a>
    </h4>
    <p class="adr">
        <span class="street-address">8001 Menaul Blvd NE</span> <br> <span
            class="locality">Albuquerque</span>, <span class="region">NM</span>
        <span class="postal-code">87110-4607</span>
    </p>
</div>
<a href="https://foursquare.com/intent/venue.html"
    class="fourSq-widget">Save to foursquare</a>
<br />
<!-- Place this script somewhere after the anchor tag above. If you have multiple buttons, only include the script once. -->
<script type='text/javascript'>
    (function() {
        window.___fourSq = {
            "uid" : "5166539"
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.src = 'http://platform.foursquare.com/js/widgets.js';
        s.async = true;
        var ph = document.getElementsByTagName('script')[0];
        ph.parentNode.insertBefore(s, ph);
    })();
</script>

It works nice, but if I use the same structure for this venue: https://pt.foursquare.com/v/centro-drag%C3%A3o-do-mar-de-arte-e-cultura/4be5f4802468c92887d30043

something goes wrong...

<div class="locInfo vcard" style="display: none;">
    <h4>
        <a class="fn" href="">Centro Dragão do Mar de Arte e Cultura</a>
    </h4>
    <p class="adr">
        <span class="street-address">Rua Dragão do Mar, 81</span> <br> <span
            class="locality">Fortaleza</span>, <span class="region">CE</span> <span class="postal-code">60060-390</span>
    </p>
</div>
<a href="https://foursquare.com/intent/venue.html"
    class="fourSq-widget">Save to foursquare</a>
<br />
<!-- Place this script somewhere after the anchor tag above. If you have multiple buttons, only include the script once. -->
<script type='text/javascript'>
    (function() {
        window.___fourSq = {
            "uid" : "5166539"
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.src = 'http://platform.foursquare.com/js/widgets.js';
        s.async = true;
        var ph = document.getElementsByTagName('script')[0];
        ph.parentNode.insertBefore(s, ph);
    })();
</script>

Any clues? I do not know if the problem is that the venue location is outside US... Is there an additional parameter that I should use for my venue?

I am using Google Chrome 18.0.1025.162 and running the code inside the Apache Tomcat 7.0.27

  • Can you a be a bit more specific about what goes wrong when you try the second snippet? Does the button work, but just fail to find the venue? If you have actual web pages using these HTML snippets that you can link to for us, that'd also be helpful. – smehmood Apr 24 '12 at 00:22
  • For sure: the window to show the venue location opens, but it do not recognize the venue. It shows an empty form to be filled. –  Apr 24 '12 at 00:33
  • Here @smehmood, the Foursquare documentation: [link](https://pt.foursquare.com/business/brands/offerings/savetofoursquare) –  Apr 24 '12 at 01:00
  • @smehmood Page1: http://dl.dropbox.com/u/6524187/stack/foursquare/page1.html Page2: http://dl.dropbox.com/u/6524187/stack/foursquare/page2.html You need to put the pages on a server. The static files do not work. –  Apr 24 '12 at 01:07

2 Answers2

0

In order to determine the correct venue, you should give as much unique details of the venue as possible. In your case, it is sufficient to add the telephone number of the venue:

<div class="locInfo vcard" style="display: none;">
    <h4>
        <a class="fn" href="">Centro Drag&#227;o do Mar de Arte e Cultura</a>
    </h4>
    <p class="adr">
        <span class="street-address">R. Drag&#227;o do Mar, 81</span> <br />
        <span class="locality">Fortaleza</span>, <span class="region">CE</span>
        <span class="postal-code">60060-390</span> <br />
        <span class="tel">+55 85 3488-8600</span>
    </p>
</div>
<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget">Save to foursquare</a>
<br />
<script type='text/javascript'>
(function() {
    window.___fourSq = {
        "uid" : "5166539"
    };
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://platform.foursquare.com/js/widgets.js';
    s.async = true;
    var ph = document.getElementsByTagName('script')[0];
    ph.parentNode.insertBefore(s, ph);
})();
</script>
diewie
  • 754
  • 4
  • 8
  • Thanks, it works now. Perhaps, the developers of FourSquare could create a list of valid tags in the documentation section or page that generates a basic skeleton of the hCard code when the URL of venue was inserted. Thanks again. –  Apr 24 '12 at 09:15
0

I had problems with that because I wrote a wrong locality (it was not exactly the same what I wrote on FS). Try to eliminate that class and give it a try...

Alex Fuentes
  • 61
  • 2
  • 5