WeChat Rich Media cards, URLs and Google maps - google-maps

I've built a Rich Media Card WeChat response to a location event that populates the URL parameter with a Googlemaps URL including the Lat/long values from the location response
like this
$return ='<xml>
<ToUserName><![CDATA[' . $xml->FromUserName . ']]></ToUserName>
<FromUserName><![CDATA[' . $xml->ToUserName . ']]></FromUserName>
<CreateTime>' . mktime() . '</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>1</ArticleCount>
<Articles>
<item>
<Title><![CDATA[Your Location]]></Title>
<Description><![CDATA[Click this card to demonstrate the mapping functionality]]</Description>
<PicUrl><![CDATA[http://www.foo/WeChat/images/map.png]]></PicUrl>
<Url><![CDATA[https://www.google.com/maps/#'.$xml->Latitude.','.$xml->Longitude.',13z]]></Url>
</item>
</Articles>
</xml>';
The Latitude and longitude variables are populated correctly
If i output the URL it is well formed.
however when I click the link Wechat opens its browser and attempts to load the URL but no map is displayed.
Is there something I've missed?
Thanks

All seems good. Tested on IPhone. Ensure it is working on the native browser outside of WeChat. If that is working then please post a screenshot here of what you are seeing in the native browser and in WeChat as well as the final URL

Related

See HTML response in chrome network

Hello when I send my html page with google chrome I can't see the path in the link Bar Though I use the method get and when I open the network angle I can't find the query request either enter image description here
On the first view is see that your request goes again a html page. Then you will get as response the html. But i suggest you will send some data. Then you have to add in every form element a name selector. Like <input name="username" ...>.
Then you need a endpoint which can handle your request. A HTML side cant do that. You need a serverside endpoint. Like api.php etc.

How to get the URL of image using Google Custom Search Engine

I'm trying to build a custom image search using Google's CSE and I'm facing some difficulties getting the URL from the result box.
I have already created a new search engine and implemented the code on my web page.
The results are showing properly and the search engine is working as intended.
Now what I would like to get is:
Avoid opening the picture on another window
Click on the image and get the real URL of the picture (not encrypted)
Display selected url on alert window
What I found so far exploring the source code is that the result image items URL links are encrypted and not showing the real URL of the image.
The following code is the result of searching the same dog using my custom search engine with Google's API and Google image search web page.
The img result using my custom search engine
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQmjyo4iFP_SQ-a2u7piFW8hZ_J4CEtDMF6_dE8Ev-RvqcZlA93DIo6uQo" title="How dogs contribute to your health and happiness" class="gs-image gs-image-scalable" style="width: 126px; height: 84px;">
The img result using Google's web image search
<img class="irc_mi" src="https://cdn1.medicalnewstoday.com/content/images/articles/322/322868/golden-retriever-puppy.jpg" onload="typeof google==='object'&&google.aft&&google.aft(this)" alt="Image result for dogs" width="529" height="353" style="margin-top: 0px;" data-iml="1552180024897">
Note that src parameter in one is encrypted and not in second one. If I do the same search on Google image I can get the real URL from the src.
So my question is: How to get the real image URL using Google's CSE? Is there any way I can get the original URL?
I have gone through this the documentation https://developers.google.com/custom-search/v1/cse/list but is not clear to me how to implement the Optional query parameters. Maybe with "linkSite" query parameter?
Best regards and have a nice day!

Dynamic Link Actions in mailchimp

I need to do dynamic link opening based on each of 3 cases. How do I write this into a link ?
Case 1: user is on desktop or Android. Send user to website link with
reference to content example.com/content/123
Case 2: user is on
iOS app is not installed. Send to App Download, post download open
content article that user tapped on
Case 3: user is on iOS app is
installed. Open app with activity link and link to that activity in
the app myapp://content/123
Any ideas how to write this into an HTML source that I can add to email? On click it will have to figure out what it wants to do.
Here is what the source looks like in mailchimp email template per content item:
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
Any help is greatly appreciated.
You are looking for the concept of deep linking. I can help you with 2 of your cases
First I'll explain how I would attempt to make this work. This sample will open the Facebook app and navigate to the Wikipedia page. You can try this out by opening this link from your Android or iOS device.
Instead of having the direct link in the email itself, I'd use one link that would then, on the server's side, determine the action to take.
In your email template, do this
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
This should then take the user to a script named 'my_server_script.php' (my example is PHP, but you can achieve this in any language).
In this script, you can then check the User Agent by using PHP's $_SERVER['HTTP_USER_AGENT']. This will give you something like Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3. Then by parsing this string, you can determine the user's OS and take an action based on that. Please do note that User Agent strings can be modified and is not always 100%, but it should be more than enough for your use.
Once you have determined the action to take, you could redirect the user to the app by sending them to the deeplink.
Here is PHP code I tested on Android earlier, this should open the Facebook app and take you to the Wikipedia page. As far as I know, it should work on iOS as well.
<?php
// Set App deeplink
$app_url = 'fb://profile/33138223345';
// Try to redirect the device to the URL
header('Location: ' . $app_url);
?>
I don't have a solution for detecting if the app is installed, but if you do find a solution for
that, you should be able to redirect them to the appropriate app store using the code below
<?php
// iTunes link
$app_install_link = 'https://itunes.apple.com/za/app/facebook/id284882215?mt=8';
// Then redirect the user to the app store location
header('Location: ' . $app_install_link);
?>
If you determine they should be sent to the desktop version, simply do
<?php
// Browser link
$link = 'https://example.com/content/123';
header('Location: ' . $link );
?>
This is personally how I would make this work since you won't have the capability in the email itself to check what device you are on and modify the link based on that.
You should however still be able to use the deeplink fb://profile/33138223345 by doing
<span>A brief funny description about this place, in one or two phrases...
Read More
</span>
and that should open the Facebook app on iOS and Android.
Hope this helped a bit!

Google static map is not displaying

I am listing lots of businesses and their static google maps in my page (with a pagination). While going through the pages, sometimes Im getting the following image instead of maps. And if I refresh the page again, I will get the correct maps.
I am sure that I have not reached the usage limit (because Im getting the same maps on page refresh).
My sample request is given below . (Note: I am not passing any API key. Is it really required ? )
<img src="//maps.googleapis.com/maps/api/staticmap?center=168 Palmers Lane Pokolbin,POKOLBIN,NSW,2320,Australia&zoom=11&size=240x180&maptype=roadmap&sensor=false" />
Pass encodeURI-ed urls to src:
<img src="//maps.googleapis.com/maps/api/staticmap?center=168%20Palmers%20Lane%20Pokolbin,POKOLBIN,NSW,2320,Australia&zoom=11&size=240x180&maptype=roadmap&sensor=false" />

Can't see my site's flash map in an Iframe

I have a website, which includes a flash map ( http://www.megalim.co.il/ ).
I try to place an iframe tag in another site(another domain), with my site as a source, it goes well except for the flash map ( I see a white box instead ).
You can see it: http://www.netravel.co.il/Megalim/
I have to note that I get the following error:
Unsafe JavaScript attempt to access frame with URL http://www.netravel.co.il/Megalim/ from frame with URL http://www.megalim.co.il/. Domains, protocols and ports must match.
Unable to post message to http://googleads.g.doubleclick.net. Recipient has origin http://www.megalim.co.il.
Hope you can help me, thanks from advance,
Ben
Sorry for the delay, seems like it was an issue of cross-browsers' scripting...