Is there a way to stop the Share Dialog on Facebook from directing users to the apps that I share? - facebook-apps

My Share Dialog works well. But after user has pressed the Post to Facebook button. It directs user to a link. Probably the redirect_uri value.
The thing is the redirect_uri value cannot be left empty. I want the share dialog just disappears after posting. Is there a way to do this? I read through the Share Dialog documentation but cannot find a way to do this.

I found my solution :)
Here is the code for my share button:
Javascript:
function visitPage(){
testwindow = window.open("https://www.facebook.com/dialog/share?app_id=[myAppID]&display=popup&href=[linkA]&redirect_uri=[linkB]","html","width=200, height=100");
testwindow.moveTo(0,0);
}
HTML button:
<button onclick="visitPage()">Share</button>
And I created an HTML that closes itself immediately like this:
<!doctype html><html><head><script>
window.onload = function load() {
window.open('', '_self', '');
window.close();
};
</script></head><body></body></html>
name it selfClosing.html or something like that and then put it into link B. DONE! :)

Related

Vue: Why is my dialog not showing up when the right condition is set?

EDIT: I answered my own question. I don't know how to mark this as resolved, since SO doesn't allow me to vote my own answer right now. Thanks everyone.
I am trying to create a confirmation box (asking to remove a layout) in which the user has to press confirm or cancel - confirm means 'yes, remove the layout and close the confirmation box', cancel means 'just close the box'.
The confirmation box opens when a user presses RemoveButton - this means that RemoveButton doesn't do the job of "removing" until confirm is pressed. Clicking the RemoveButton should make the dialog to show up.
The problem is the my dialog is not showing up. I ran Chrome dev tool and made sure that setShowRemoveLayoutDialog(true) is working, but removeLayoutDialog is not opening. Even when I set a dev tool breakpoint on public removeLayout(layoutName: string), the dev tool could never reach it.
Can anyone tell me what I am doing wrong?
(We don't have to talk about CSS here since it is already built by my other teammates)
(I cannot do .confirm(confirm message) because it will trigger a no-alert error for lint. So I have to insert it into template and make a div or element for that).
Thank you!
This is my Vue/html template:
<RemoveButton #press="setShowRemoveLayoutDialog(true)">
<removeLayoutDialog v-if="showRemoveLayoutDialog"
:layout-name="props.node.name"
#confirm="removeLayout"
#cancel="setShowRemoveLayoutDialog(false)"/>
</RemoveButton>
This is my <script>:
#Component({
removeLayoutDialog,
...
})
export default class ThisClass {
...
public showRemoveLayoutDialog = false;
public removeLayout(layoutName: string) {
this.doRemoveLayout(layoutName);
this.showRemoveLayoutDialog = false;
}
public setShowRemoveLayoutDialog(isShown: boolean) {
this.showRemoveLayoutDialog = isShown;
}
}
I realized that having the dialog inside the button was the problem.
Instead of having <button ... <dialog></dialog> </button>, having <button><dialog> solved the problem.

Full screen webpage

I'm trying to make my webpage fullscreen. I've made it work on Chrome, but for some reason it wont work on safari. Anyone know why?
<img onclick="launchFullscreen(document.documentElement);" src="http://e-daktik.dk/ranger.gif" alt="">
<script>
// Find the right method, call on correct element
function launchFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
</script>
It would be better to try and have the user simulate this themselves (by clicking F11 or any other key for their specific browser) because this will only work with Google Chrome and Internet Explorer. You should have a message saying to click F11 or something if you really need your webpage to be full screen. I hope this helped you.

How to refresh on closing dijit.dialog

I'm using dijit.dialog to show the popup dialog. How do I refresh the parent page on closing dijit.Dialog? Please advise. thanks
You need to add a listener to the hide event, and you need location.reload(). It will be a lot easier to answer your question if you post some code and list what you've tried already.
Here's a jsfiddle illustrating how to use location.reload() when a dijit/Dialog closes with Dojo 1.8.
The relevant code:
d.on('hide', function() {
console.log('closed');
location.reload();
});
You can use code as below, you just need to now your modal object's name.
var dialog = registry.byId("modalDialogObjectName");
var url = dialog.get("href");
dialog.set("href", url);

on(release) {...} or myButton.onRelease = function() {...} - action script 2 issues

I am having real confusion with some flash banners I'm creating and making the button into a clickable object which opens a web page.
I have been using this code for a while below, which works...
on(release){
getURL("http://www.the-dude.co.uk", "_blank");
}
And I placed this code on actual button within the actions panel
However I have been told the code above is very old and that I should use action script like below...
buttonInstance.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}
So I've tried to get this method below to work but nothing happens when I click the button, and I get one error, this...
So in a nutshell I cannot get this newer code to work! Ahh
Can anyone please help me understand where I am going wrong?
I have tried placing the new code in the Scene 1 of my actions. No worky..
And I've also tried placing the code below, actually on my button within the actions panel...
this.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}
Still not working.
My scene settings are alway this...
Any help would be great thanks.
You need to place the code below on the same timeline as the instance of the button (as you tried). And the instancename of the button must be "buttonInstance".
You can set the instance name in the properties panel when the button is selected.
buttonInstance.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}

ROR + Reopen a new tab in same window using RUBY code

In my project, I want to re-open a new tab using ruby code. When user clicks at attachment link, then that pdf should be open in new tab of same window. I tried a lot but I am not getting the way to solve it. Please guide me.
I am not sure if this is possible using Ruby since it deals with the UI part. It is indeed very much possible using HTML and Jquery.
You could simply set the target attribute as blank in the hyperlink redirecting to the PDF and it will open the file in a new tab. Something similar to this :
<a href="http://www.mysite.com/files/xyz.pdf" target="_blank">
If you want to use JQuery for this, you can try something like this :
$(document).ready(function() {
$("a").click(function() {
link_host = this.href.split("/")[2];
document_host = document.location.href.split("/")[2];
if (link_host != document_host) {
window.open(this.href);
return false;
}
});
});