Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
First of all, I want to tell you that this Module is amazing. It is exactly what I have been looking for.
Now, to the business at hand, I would love to have a popup load when a certain page is visited.
Example: When an anonymous user visits the front page, the login/register node I created pops up.
I don't want to redirect them to the node itself, I want to stay on the front page. Is this possible without a physical "click" on the link?
Comments
Comment #1
cmporter83 CreditAttribution: cmporter83 commentedI have been going through everything I can find on this topic to try and make this happen. I have even tried the standard Javascript onLoad click stuff, but sadly it doesn't remember the Class so it loads the page itself, and skips the popup. I have tried going through all of the JS code for the module, but honestly it is over my head. I cant seem to identify anything in there that I can just call out to create a popup.
At this point, I have created a block that only shows when anonymous users hit my front page. I have placed a link within that block that when clicked a popup with a custom login/register screen. I wonder if using some script to create the popup when the ID is present would work.
Example: The block contains the link with an id of "autopop". Then using "document.getElementById('autopop')" to launch the popup.
Anyone wanna help?
Comment #2
cmporter83 CreditAttribution: cmporter83 commentedWell i have found a way that this sort of works in IE only.... but things dont work quite right, and dont work in FFox. Anyone out there up for helping?
I made a link with the class="popups" and id="autopop" then added the following to the page-front.tpl.php
Comment #3
rjdjohnston CreditAttribution: rjdjohnston commentedDid you figure this out? I have the same need.
Comment #4
cmporter83 CreditAttribution: cmporter83 commentedI have been working on this since December, and still don't have an answer. Can ANYONE out there help me? All I am trying to do is launch the login form in a popup when someone loads a page. No click of the link, it just pops up as soon as the page loads. Surely this can't be that complicated!
What is the actual process that happens when a link with that ID is clicked? Can we not just run that operation on load?
Comment #5
beyond67 CreditAttribution: beyond67 commentedIm curious about this also.
Comment #6
Bertjuh CreditAttribution: Bertjuh commentedWow, still no solution? I'm having the same problem. I've tried for some days now different combinations of modules like popup, webforms, popup block, ajax api but no solution to the automatic popup thing.
BTW document.getElementByID works fine on IE but not on all browsers, there is other code to make sure it works on all browsers.
Comment #7
jacobpov CreditAttribution: jacobpov commentedplease update on this one I need this kind of thing to work.
Comment #8
Michsk CreditAttribution: Michsk commentedthis is not a nice way, but you could create a hidden link (css) and when the body is loaded make jquery click that link to open the popup.
Comment #9
Michsk CreditAttribution: Michsk commentedthis is not a nice way, but you could create a hidden link (css) and when the body is loaded make jquery click that link to open the popup.
Comment #10
hrmoller CreditAttribution: hrmoller commentedSubscribing. Will contribute when/if I got something.
Comment #11
jefkin CreditAttribution: jefkin commentedAssuming your link is still provided with id="autopop",
Add this code to your home page, perhaps in a block.
==========
Alternatively you can make a mini-module to do this, (I prefer the mini-module method, as it's more robust and simpler to repeat).
Comment #12
Mandakini_Kumari CreditAttribution: Mandakini_Kumari commentedI tried on http://ayushiinfotech.com/ but not worked for me.
Currently I am using below script
<div style="display: none;" id="light" class="white_content">
function autopopup() { document.getElementById('light').style.display='block'; document.getElementById('fade').style.display='block'; } autopopup();include("index1.html");
</div><div style="display: none;" id="fade" class="black_overlay"></div>
Comment #13
YK85 CreditAttribution: YK85 commentedsubscribing
Comment #14
ruinze CreditAttribution: ruinze commentedif you're creating a module you can add a JS and use Drupal.behaviors and put some event that if an id of a certain element is present then display it on popup
example :
on your page
on your js
i'm sure we can implement this when not on module
sorry for my bad english
Comment #15
Ramandeep_Kaur CreditAttribution: Ramandeep_Kaur commentedThanks ruinze , this solution works like a charm.
We need to keep 2 things in mind for this code to work
1) The popups module is enabled.
2) In the popups configuration page "Scan all pages for popup links." is checked.
Comment #16
tacoparty CreditAttribution: tacoparty commentedCould someone post some basic directions on how to do this? I see chunks of advice here but am not really sure where to start. All I need, like the original poster, is for a pop-up to display when a certain page loads. I'm surprised this isn't more common or easier to do with Drupal. I've been looking all over to no avail.
Comment #17
hawkeye.twolf@tacoparty - Here are the steps to make this work:
Hope that helps!
Comment #18
diwakar CreditAttribution: diwakar commentedhi derek.deraps,
thank you for explaining it,now that i got the popups with a message, if you could pl guide as to how to include login form,
thank you