Article open in modal window after a user click on facebook share link and come back to your site - facebook

I think I need your help here... On my site, I've done all the articles open in modal window by clicking on the link "read more" that exists in every article.
Also, each article has a button that shares this article on facebook.
But, when the user who will see my article on facebook, click this link to read the article, it come back to my page, but the article (logical) not open in modal window!!!
Is there any way, in the "return" of the user on my site, after having pressed the link of facebook, automatically open this article in modal window? Or, if the question above can't be done, is there any way by customizing the link I send to facebook, to set it in the "return" of the user to my site, after having pressed the facebook's link ofcourse, to show the article in intro view and not in full view?
Thank you very much for your time!

I'm using modal windows in my website and I utilize the following HTML code to open an article in a popup:
<a class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}" href="yourarticleid=759&tmpl=component&task=preview">Open a link in modal</a>
The method above uses the native function for creating the modal window and calls the article you need to display. However, since Facebook formats all posted links I don't think you'll be able to include the crucial piece of code (below) that triggers the modal window.
class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}"

Here is a kind of solution, an idea in other words, that make your articles open in modal window, after a user click on facebook share link and then come back to your site.
In my case I did this...
To open modal windows in my site, I am using the extension modalizer from nonumber.nl. This extension adds something like that &ml=1 at the end of article's url. The link that comes from facebook don't contain this &ml=1 at the end. So...
1. First of all, in to my article's content, I should include modal's behavior.
2. Then, I should make my code check if the url has this &ml=1 at the end or not.
3. After, I should decide what my code will do in those two cases. So, I want to do nothing if &ml=1 already exists and I want to open facebook's url in modal window if &ml=1 doesn't exist. I also want everytime that I close my modal window to load index.php, else user will see my article on frontend view.
Here is the code for all this:
<?php JHTML::_('behavior.modal');
$url= 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (strstr($url, "&ml=1")){/* Do nothing */}
else {?> <a class="modal" id="modalWindowLink" href="<?php echo $url ?>"></a>
<script>
window.addEvent('domready', function(){
window.addEvent('load', function(){ SqueezeBox.fromElement($('modalWindowLink')); });
});
SqueezeBox.addEvent('onClose', function(){ window.location = 'index.php'; });
</script>
}
<?php } ?>
If you have any better idea, or if you see something that could work better in other way, please let me know!!!

Related

A pop up window in ColdFusion

I need a simple pop up window for displaying a detail policies when users click on a link. So within texts there will be a link such as see detail here and when user click see detail here a pop up windows show up.
I know how to do it in javascript but this type of pop up nowadays looks so ancient and can be blocked by pop up blocker.
Can I use cfmessagebox? I have googled and got many examples but none is calling the cfmessagebox from a link.
Can anyone help?
according to the documentation
<script type="text/javascript">
function showMB(mbox) {
ColdFusion.MessageBox.show(mbox);
}
</script>
<cfform>
<p>Click a button display the corresponding message box.</p>
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox01')">
</cfform>
<!--- Code to define the message boxes. --->
<cfmessagebox name="mymessagebox01" type="prompt"
message="Write a short description about yourself"
labelOK="This is OK" labelCANCEL="Cancel this"
callbackhandler="showResult1" multiline="true"/>
form/button code can be rewritten into:
show
or
show

target="_parent" in Fancybox is loading a new window

Ok here's a messy one.
I've got an iframe on a page, and in that iframe I've loaded up a Fancybox iframe with a link in it that has target="_parent". My only problem is it's loading the link in a new window for some bizzare reason, not out of the fancybox and into the iframe.
My link is Continue Checkout
You can view an example of the code at https://www.dpdesignz.net/homefresh/dps/success.html. My biggest thing though is that even though this page is on my https://www.dpdesignz.net domain, the link in the button cannot be changed from the http://www.dpdesignz.co.nz to https://www.dpdesignz.net
Can anyone see what may be going wrong here?
Your link has the class="button" but there isn't in any part of your code anything that binds that selector to fancybox
something like:
$(".button").fancybox({
width : 650,
height: 400,
type : "iframe"
});
otherwise it will always open in anew window

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

How to close a iPad webapp and open safari?

I'm working on a webapp for iPad. What I want is provide a "save & quit" option. When the user presses the quit button, I safely update my database and show a screen who thanks the user for using the webapp.
What I want to do now is actually close the webapp. As window.close(); doesn't seems to work I have found a workaround with links.
Clicking on a link in a webapp closes the fullscreen app and opens safari. So far I tried to embed an hidden link in my mage and trigger it with link.onclick(); but it doesn't work, and document.location= doesn't open safari.
Here's the HTML example:
<body onload="leave();">
Modifications saved, goodbye!
<a id="goodbye" href="www.mahsite.com" style="display:none;"> </a>
And the JS:
function leave() {
window.close();//Doesn't work
window.setTimeout(function e(){document.getElementById('goodbye').onclick();},1000);
return true;
}
Can someone give me an idea? I'm aware that the onclick() won't work unless I have a onclick handler attached to my link, but I don't have any other idea.
Try
self.close();
or
self.window.close();

MVC Form - Clear ModelState on Back in Browser

I have searchbox in my web app.
I am curious how to clear ModelState when user hits back button. The page retains the 'text-input' from the search results page when the user hits back and goes to home page, which also has a search box.
Before Posting the ques did some initial research here.
I checked similar question on StackOverflow and saw that ModelState.clear() helps you clear he info. But when the user hits "back", the controller does not get called (obv!!) thereby Clear() does not get called.
So what is the best way to get around it.
One possible way would be to use javascript and clear the value when the page is loaded. For example with jQuery:
<script type="text/javascript">
$(function () {
$(':text').val('');
});
</script>