Any way to load a popup inside the iframe? - javascript

I'm wondering if i can do that,
Basically what im trying to achieve is the facebook share block already turned on when the user comes to the page but facebook won't allow iframing it..
The idea is that the user will see the share window without clicking the initial share button this way they will only need to share it on facebook's share box without the need to click share twice.
I was just thinking about the idea and how it could help while making the share function popup-less and to show the share prompt when the document loads and not whenever a user clicks share and will be glad if that can be achieved.
I has the idea of the share popup automatically open inside an iframe but i have no idea if that can be done.

To display popup inside iframe you've to set "display: 'iframe'" and you've to set the access token that you got by authentication
You can also view errors by using "show_error:true"
FB.ui({
method: 'apprequests',
message: 'Facebook for Websites is super-cool',
display: 'iframe',
show_error:true,
access_token: '#{#access_token}'
});

You can use Feed Dialog with FB.ui (JS-SDK) to achieve sharing dialog that can be displayed within your application canvas (which is running within iframe).
You can also use regular pop-up window. Most browsers blocking pop-ups if opened not by user interaction like click, but form submit is also considered user interaction in most cases, so submitting a form with target attribute pointing to invisible iframe will allow you to open popup on submit event...

Related

Javascript click on coordinates inside iframe

I have searched some things about click on coordinates with javascript and
i have found that this line of code helps you click on x,y coordinates
document.elementFromPoint(x, y).click();
So when i put the width and height of an html element or a button it clicks it good and it redirects me to the page that i want.
But when i have an iframe html object (like a google ad) it doesnt work.
I cant understand why though because i think "click()" is like simulating a normal mouse click... or am I wrong with this?
I have read that iframe has a protection that you cant go inside the html elements but all i'm trying to figure out is how to simulate a normal click on the iframe.
Thanks a lot for your time.
This is obviously prohibited due to security issues.
If it was possible to programmatically trigger a click event within an iframe, you could trigger certain actions on behalf of the user visiting your page. You could for example open your own twitter account in an iframe -- the visitor of your page logged in -- and let the user follow you with a click on the follow button. You can certainly think of more critical examples...
Basically, you could take over all accounts the user is logged in with a cookie. You can open any web page in an iframe and act on behalf of the logged in user by simulating click or keyboard events.

Share content on Facebook without opening a popup

I have one button and I want to share the content on Facebook without opening Facebook dialogue box.
Present code works like:
Click on a button;
It opens Facebook share dialogue;
And again click on share from dialogue;
I want something like this: click on a button and it would be shared on Facebook.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed#publish
You would need to authorize the user with publish_actions to do that. You need to go through the Login Review process with that permission and the message parameter must be 100% user generated according to the platform policy.
A lot of things to consider, i´d just stick to the popup.

How to get Data of Iframe and store it in MySQL using Javascript

I have an iframe which opens a website. I want to know what the user has clicked on the iframe. For example- The iframe opens yellowpages.com , I want to know what phone number has the user clicked on or which company has he clicked on? Is it possible?
It is not possible to spy on what a user does on another website, even if you put that website in a frame on your site.
If you had the cooperation of the other site, then it could bind an event listener to monitor clicks and then use postMessage to inform your site across the frames.

How facebook/twitter share buttons avoid being blocked by popup blockers?

When a user which is not logged in to Facebook or Twitter, clicks the like/tweet button, a popup comes up asking the user to log in. This popup is not blocked by popup blockers of any kind. in IE for example, it opens up but anyway IE state a warning to the user. The bottom line is that all buttons probably use the same method.
I have a button that people click on it and it should open a similar screen, but it always gets blocked.
The button (in JS) works pretty much like FB like button. It checks if the user is logged in. If he does, then send the "like" to the servers. If he does not, then the login popup appears (and gets blocked).
So, it is a initiated by a user although not fully direct outcome, since we need to check if he logged in or not.
What is best method to do that?
The Popup Is activated by a click using the like, tweet button and they actually show only 1 popup. If you want, you can try by using only a single popup based on click for your website and you will definitely be able to understand this.

Facebook Connect Bug - JavaScript Refresh

Facebook Connect has a recent bug that is causing the permissions pop-up window to not close and refresh the parent window as it is designed to do. Instead, after approval by the user it attempts to load the page directly in the pop-up window which is an awful user experience and really hurting our registrations. You can see the bug by registering for our site using Facebook Connect: http://alltrails.com
The URL of the page after the user connects that Facebook Connect is incorrectly loading in the permissions pop-up window is of the form:
http://alltrails.com/?installed=1&session={"session_key":"2.Gu0duOqdElNjXRac5wnetw__.3600.1283799600-1486832834","uid":1486832834,"expires":1283799600,"secret":"tKFaEgBTF9RJeuQZfYUSCw__","base_domain":"alltrails.com","sig":"a8dd9f75418b530ae6c3d935e14274c4"}
I'm hoping that someone much better at JavaScript than myself could suggest a simple code snippet that we could add to our homepage that would only be invoked if the page URL includes '?installed=1' and would do the following to allow the same user experience as Facebook Connect was intended to provide:
Close the permissions pop-up window
Load the appropriate page http://alltrails.com/register/facebook in the original parent window
I've tried to do this a bunch of different ways but haven't had any luck with getting it to work correctly. Thanks in advance for your help!
It's a (unconfirmed) bug.
http://bugs.developers.facebook.net/show_bug.cgi?id=12260
Hopefully it gets more votes so it gets fixed - vote people!
In the meantime, i am (attempting) to employ the following 'creative workaround':
Add logic to my Default.aspx page to detect that URL they are redirecting to in the popup.
Redirect to my page, FacebookInboundAuthorization.aspx, preserving querystring.
On load of that page, register some JavaScript to close the popup and manually fire the "onlogin" event handler for my button.
EDIT - Another possible solution
So i do something like this for the "Disconnect from Facebook" button, which has a similar bug which has been in FBC from day 1. If the user is already logged in, and you click the "Disconnect from Facebook" button, the "onlogin" handler is not fired.
So what i ended up doing is replacing the Facebook Disconnect button with my own regular anchor tag, mimicing the Facebook CSS. This way i can have full control over the click event (fire the function i want).
So, this principle could (theoretically) be applied to this current bug.
That is, after you do FB.Init on client-side:
Check FB auth status using FB.Connect.ifUserConnected
If user is connected, hide the regular FB:Login button, and show your "fake" FB Login button. Copy across the "onlogin" function from your regular FB:Login button to your fake button as the onclick event.
Your Fake FB Login button would be a regular anchor tag, with the same CSS applied to the regular FB Login buton.
So essentially, if the user is already connected, we don't really need FB's intervention for authentication, we can just do whatever we want (request perms, redirect, etc).
That should work.
Unfortunately i have higher priority things i need to work on, but it sounds like this is top priority for you.
So give that a go, hope it helps.

Categories

Resources