Reputation: 1473
https://jsfiddle.net/6yrr82ph/
i am trying to share this link
http://www.domain.com/list.php?id=10&category=food
but on share page i am just getting
http://www.domain.com/list.php?id=10
this link on the share page.
i have a trouble form getting 2nd variable category
.
i don't know what wrong is going on. please fix this code
<div class="list text-center" style="margin: 10px;">
<a class="item" href="#" onclick="window.open('http://www.facebook.com/sharer.php?u=http://www.domain.com/list.php?id=10&category=food', '_system', 'location=yes'); return false;">
facebook share <i class="fa fa-facebook-square"></i> </a><br><br>
<a class="item" href="#" onclick="window.open('http://twitter.com/share?text=title of blog&url=http://www.domain.com/list.php?id=70&category=food', '_system', 'location=yes'); return false;"> <i class="fa fa-twitter-square"></i> twitter share
</a>
</div>
Upvotes: 0
Views: 230
Reputation: 894
also try this
<script>
url='http://www.domain.com/list.php?id=70&category=food';
url= encodeURIComponent(url);
</script>
put this encoded url to your code
window.open('http://www.facebook.com/sharer.php?u='+url, '_system', 'location=yes')
Upvotes: 0
Reputation: 3515
You need to encode your url with urlencode
.
Try this :
<a class="item" href="#" onclick="window.open('http://www.facebook.com/sharer.php?u=<?php echo urlencode("http://www.domain.com/list.php?id=10&category=food");?>', '_system', 'location=yes'); return false;">
Upvotes: 1