facebook like button not working correctly - php

I have a problem with my facebook like button. Basically I have an ajax gallery on my page and so when the image changes I change my facebook button so that the button represents the url to the new image. But when I click share it just shares the original url even though it has changed. Here is an example:
When page loads the code for the facebook button is:
<iframe scrolling="no" frameborder="0" style="border: medium none; overflow: hidden; width: 80px; height: 21px;" allowtransparency="true" src="http://www.facebook.com/plugins/like.php?href=http://go-style.co.uk/test-gallery/&layout=button_count&show_faces=false&width=80&action=like&font=lucida+grande&colorscheme=light"></iframe>
I then use jQuery to change the code to this:
<iframe scrolling="no" frameborder="0" style="border: medium none; overflow: hidden; width: 80px; height: 21px;" allowtransparency="true" src="http://www.facebook.com/plugins/like.php?href=http%3A//go-style.co.uk/nggallery/page-7029/image/30&layout=button_count&show_faces=false&width=80&action=like&font=lucida+grande&colorscheme=light"></iframe>
Yet clicking on the new button likes the original url
Anyone know why this is happening?

Have you tried refreshing the iframe after changing it SRC?
$('#youriframe').attr("src", $('#youriframe').attr("src"));

It was a caching issue with facebook in the end!

Related

How to disable text selection in embeded pdf in html page?

I'm developing an e-library website and I want to display book content (saved in pdf format). The problem is the user that open embeded pdf still able to copy the content by highlight the text. Where do I need to set the code?
I already put style="width:100%; height:100%; user-select: none; -webkit-user-select: none;"
this is my current code
<iframe src="http://localhost/ci_crud/upload/product/Proposal_Thesis.pdf#toolbar=0&navpanes=0&scrollbar=0" title="PDF in an i-Frame" frameborder="0" scrolling="auto" style="width:100%; height:100%; user-select: none; -webkit-user-select: none;"></iframe>

youtube video play in background html files

I was fascinated by background videos that we see in webpages like https://www.laitkor.com/ , I wanted to develop something similar, but this time I to get the video from Youtube. How can I do it?
P.S. The video should play automatically.
This is how to embed a YouTube video as a webpage background:
<div style="position: fixed; width: 100%; height: 100%; z-index: -999;">
<iframe frameborder="0" height="100%" width="100%" src="https://youtube.com/embed/[videoID]?autoplay=1&controls=0&showinfo=0&autohide=1">
</iframe>
</div>

Click-Event on iframe without javascript

I need a iframe with link attached to that iframe. I have a iframe with src containing image file and id containing the url where i should be navigated. I should not use javascript or any php coding for link creation. when i paste that iframe in any page, its should be a clickable iframe.
adding tag doesn work in some browsers like chrome and firefox.
Eg:
<iframe src="imagepath" scrolling = "no" width="728" height="90" id = "redirect url"></iframe>
With the following HTML and CSS you get an iframe with a link overlay. You have to specify the redirect url in the a tag. If you you really have to specify it in the id of the iframe, you definitely need JavaScript.
Here's a demo how it looks like (only tested in Chrome): http://jsfiddle.net/2kA3J/
CSS:
#container {
position:relative;
width:400px;
height:400px;
}
#container a {
position:absolute;
width:100%;
height:100%;
}
#container iframe {
width:100%;
height:100%;
}
HTML:
<div id="container">
<iframe src="imagepath" scrolling="no" ></iframe>
</div>

Error iframe does not scroll in Chrome when using facebook comment?

I added an iframe facebook comment, in Firefox it scrolls, but in Chrome it does not, How do I fix it ?
<iframe src="https://www.facebook.com/plugins/comments.php?api_key=172666652872245&channel_url=https%3A%2F%2Fs-static.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D27%23cb%3Df3a81f3cfd7ece2%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff1b19ded3a3bee%26relation%3Dparent.parent&href=http://dongcam.vn/t84630&locale=vi_VN&numposts=10&sdk=joey&width=550"
scrolling="yes"
frameborder="0"
style="border:none; overflow-x:hidden; overflow-y:scroll; min-height: 100%; width: 470px; background: #FFF;"
allowTransparency="true">
</iframe>
You need to remove min-height:100%
here's a JS bin:
http://jsbin.com/oBITUkE/1/edit

Facebook Send Button - How to pass generated PHP variable in url

I am currently coding a website where lines of information are drawn from a database and displayed using PHP coding (about 20 pieces of info per page). I have included the javascript SDK for facebook after the head and generated the div tag for the send button for each piece of information. My intention is to have a user click the send-button for a specific line of information and transmit the url for only that info - not the main page.
Using php coding I have changed the data-href URL in the fb-send div to represent the referenced information and pass the php variable through the URL. While the URL tests correctly it is not being represented when the send button is clicked (it only references the main page).
Is it possible to pass PHP variables through the URL of the send button?
If so, how can I do this?
If not, what are other options to achieve my desired outcome?
Please let me know if my problem is unclear! Thank you very much for the help!
Try with this
$url_view = "http://".$_SERVER['HTTP_HOST'] . getenv('REQUEST_URI');
$facebook =
"<div class='socialshare_fb'>
<iframe scrolling='no' style='border-width: initial; border-color: initial; overflow-x: hidden; overflow-y: hidden; height: 20px; width: 90px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial;' title='Share on Facebook.' src='http://www.facebook.com/plugins/like.php?href=".$url_view."&action=like&layout=button_count&locale=pt_PT &node_type=link&show_faces=false&width=90'>
</iframe>
</div>";
echo $facebook;

Categories