Recently, while working with a client, I faced an issue related to TripAdvisor review widget. The issue was the widget was not being rendered on the webpage with secure (HTTPS) url. The widget was loading Javascript from non-secure (HTTP) url and the webpage was blocking that content being requested from a non-secure url.
After going through TripAdvisor support forums, it became clear that they had no solution for this, as the request to fix this bug had gone unanswered and related post had been closed. It was time for brainstorming 🙂
Have a look at their widget:
<div id="TA_ssnarrowcollectreview339" class="TA_ssnarrowcollectreview"> <ul id="qt8r6ky" class="TA_links wvFoTJq"> <li id="aEQCghjce" class="8al3DtAX"> <a target="_blank" href="http://www.tripadvisor.com/"><img src="https://www.tripadvisor.com/img/cdsi/img2/branding/150_logo-16124-2.png" alt="TripAdvisor"/></a> </li> </ul> </div><script src="http://www.jscache.com/wejs?wtype=ssnarrowcollectreview&uniq=459&locationId=4984311&lang=en_US&border=true&display_version=2"></script>
The widget loads Javascript from url http://www.jscache.com/wejs?wtype=ssnarrowcollectreview&uniq=459&locationId=4984311&lang=en_US&border=true&display_version=2
This request generates a dynamic Javascript code which is as below:
document.write('<script src="http://www.tripadvisor.com/WidgetEmbed-ssnarrowcollectreview?uniq=339&locationId=4744311&border=true&lang=en_US&display_version=2"></script>');
You can see, it loads another Javascript in the widget, with the source url beginning from HTTP which is a red flag for secure (HTTPS) webpage. This was the issue which was preventing the widget from being rendered.
I replaced the Javascript in the original widget code with following:
<script src="https://www.tripadvisor.com/WidgetEmbed-ssnarrowcollectreview?uniq=339&locationId=4744311&border=true&lang=en_US&display_version=2"></script>
Note the HTTP had been replaced with HTTPS in the “src” attribute of above script. So the final widget code became:
<div id="TA_ssnarrowcollectreview339" class="TA_ssnarrowcollectreview"> <ul id="qt8r6ky" class="TA_links wvFoTJq"> <li id="aEQCghjce" class="8al3DtAX"> <a target="_blank" href="http://www.tripadvisor.com/"><img src="https://www.tripadvisor.com/img/cdsi/img2/branding/150_logo-16124-2.png" alt="TripAdvisor"/></a> </li> </ul> </div> <script src="https://www.tripadvisor.com/WidgetEmbed-ssnarrowcollectreview?uniq=339&locationId=4744311&border=true&lang=en_US&display_version=2"></script>
Source url of the TripAdvisor logo image had also been changed to secure one (HTTPS) in the above code. This code rendered the widget successfully on secure (HTTPS) webpage.
Phew!! Wasn’t that tricky? What do you think?
I am having the same problem, but because I am not a code writer I am having problems understanding how to correct my code. I have been strugggling with this for months.
If I send you my code, is it possible to help me correct it for https?
From what I can discern, I only have to change http to https in two places?
Do I need to remove the “wejs?…” statement shown above in red?
Thank you
Hi Susan,
Sure, you can send me code at lordofthechamps[at]gmail[dot]com
thanks for this post, it helped me resolve our issue with a certificate of excellence after switching to https. i used the following code – replace ID, location ID, language and year for your own needs:
https://www.tripadvisor.com/WidgetEmbed-certificateOfExcellence?uniq=ID&locationId=LOCATION-ID&border=true&lang=LANG&year=YEAR&display_version=2
Great 🙂
Useful info, thanks!
Just to add, for those running “mixed-protocol” sites (where only select pages are HTTPS), it’s possible to omit the “https:” prefix and start the link at the double-slash, e.g.
//www.tripadvisor.com/blahblah
This way the link will request the URL in whichever scheme the referring page was served under.
Yes, Robin, you are right.
But requesting the “https” url from a non-https page does not cause any issue, that’s why I didn’t mentioned it here.
Thank you very much! I’ve searched this information about 3 hours 🙂
Really useful and helpful.
I am using Enfold Theme and using SSL certificate, so before I fixed it I had only bullet-point before Tripadvisor logo.
Great Serge, I am glad that you found it useful 🙂
Great! It works. Thank you!
You’re welcome, Alex 🙂
Thank you for this solution – solved my issue in minutes!
You’re welcome, Mike.
Hi Champ – this looks really simple! And – I think Tripadvisor has finally started to generate their code with the “S” but I just upgraded to SSL, and have a broken widget now – just showing the TA logo directing to TA root URL.
Here’s the code the widget generates;
https://www.jscache.com/wejs?wtype=cdsratingsonlynarrow&uniq=580&locationId=1146548&lang=en_CA&border=false&display_version=2
Any ideas? Sorry to be a bother, but I posted on Stackoverflow too, and they referred me back to your post 😉
Hi Jim,
When you click the link you have mentioned, you will find Javascript with following source:
http://www.tripadvisor.ca/WidgetEmbed-cdsratingsonlynarrow?border=false&locationId=1146548&display_version=2&uniq=580&lang=en_CA
You have to use https version of this url in your TA widget replacing the source url you just mentioned.
Hi there, It’s a year since the last post on this topic. Whilst Tripadvisor has started to use https, I still can’t get there code to work. Having just moved over to a SSL site, these widgets are getting a pain in the neck. Any chance you could have a look at the attached code? I’ve tried your solution but it doesn’t work for me:
https://www.jscache.com/wejs?wtype=rated&uniq=220&locationId=3565361&lang=en_US&display_version=2
Thanks,
Graham.
Hi Graham,
Yes, I can have a look if you let me know where are you using the TA widget.
Hi there, Just wondered whether you got my reply?
Will try again. The page the TA widget is on is:
https://www.isleofskyeaccommodation.com/culnacreag/
Scroll down the page, you will see a sub-heading Tripadivsor Reviews.
Thanks,
Graham.
Can you enable the TA widget now?
Still only the logo at this end. I did reload/refresh using F5 with Firefox, I then used Google Chrome, but still only the logo unfortunately.
Can you post original widget code you got from TA?
Trying to post the widget code, but it’s not showing on your page. I’m using IE for this, so will try with another browser.
Can’t seem to post the raw code on your blog. Is there any way of sending an attachment?
Okay. You can send it to rajat[at]heateor[dot]com
Just a thought would it not be easier to go back to the page and ‘view source’?
Is that the original widget without any modification?
It’s recently been copied off TA site, I’ve not touched it.
Okay. I checked that but there isn’t any related error in the browser console that might give a clue about the problem. Did you try to contact TA about this problem?
Well judging by the many, many pages I’ve trawled through trying to resolved this issue, the one avenue which quickly led to a dead end was hoping TA would sort it out. Their standard reply to posts on the matter on their pages is to say ‘off topic’ and redirecting the poster to a forum for property owners, I’m not an accommodation property owner (thank goodness).
So is that it then?
Your problem is same as the person who posted at following link
https://www.tripadvisor.in/ShowTopic-g1-i12105-k10402468-Widget_script_in_wordpress-TripAdvisor_Support.html
You would like to follow what they suggested there.
Hi there, Will investigate. Thank you for all your time and trouble with this nonetheless.
Graham.
You’re welcome 🙂