Automatic modal when starting home page

There is some issue generally with this code provided above. I think there is some issue with jquery.

I get aways the error on console. Not sure why.

Update: i tried for 3 hour to get this modal working. And suddenly it worked from alone. Not sure why.

Some nice Modals. Even if you don’t use these they give you a lot of ideas for using them.

casey

Salut all, I can’t get my head around an issue with automatic modals happening as from Blocs Version 3.2.3 . Automatic modals (I tried all different formats as described above) are not showing up in preview as well as after exporting when created with version 3.2.3 and higher. (including 3.3.0b1). However when opening the Blocs file created (in v3.2.3 or higher) in Blocs 3.2.2 or lower the modal pops up as a charm and exports as well. I’ve filed a bug @norm. Do other users have similar issues?

Many thanks to all contributors on this forum to who keep amateurs like me going.

Jerry

@Pealco,

Hello and thank you for the javascript code solution! I was able to get the ‘ALWAYS START MODAL’ working as it should, but the ‘ONE TIME MODAL WITH COOKIES’ I could not get anything to happen. Do I need to do something (with cookies, etc) to enable that code? I pasted it in the footer section of the page settings. Here’s the exact code I pasted:

Any help greatly appreciated! Thank you!

42%20PM

Please wait for tonight… I will create 6 new snippets all about this… I will publish the snippets in the normal @pealco topic.

Hello @Creative please check the @pealco topic, I create a few modals snippets, and a new snippet, check it please…

@Pealco, @Wam, @Eldar, Been on mini site and some great code on there. On the on load Modal with cookies how do you prevent the user pressing the escape key

Cheers

sorry found code Blocs Code - Acess cheers

1 Like

If you need any help, just let us know…

Hi All

Thought I would share what code I’ve implemented and what I have noticed
Screenshot 2020-04-08 at 12.28.35
I’ve included this in the main header so that it is global across the whole site and disables the esc key and clicking outside the box. Works brilliantly but what I’ve noticed is if you refresh the page or go from site and then come to the site then then you can bypass the initial agree button.

Is there a way to prevent this? Oh and by the way for those trying to implement this it needs to be uploaded to server to work.

Stephen

Hello @steviemc, this version, have cookies, so if you use it once then the browser have this cookie and don’t ask it again. Try to clean your cookies and you will see that the agreement appears again, so do you need to have it all the times?

Hi @Pealco this version works when you visit the site once and browser has the cookie. The problem is if you refresh the load of the page or if you go to another website and then back to you original site the browser has the cookie installed without the user agreeing to the terms. What I need is the browser only to install the cookie after the user has accepted. ie it will always prompt the user whichever until they have accepted then the cookie is installed

It seems @steviemc that you need some type of session control associated with your pop up challenge. Which with a CMS would be inherent, but on a static website not so much.

There is a property called sessionStorage that gets cleared when someone deletes a tab or closes the browser. Which I think could potentially be used in your existing script. Maybe @Pealco has an idea, I have never used it myself.

Window sessionStorage Property

But for what I see the issue is if you have a share computer or tablet as what you want is an age checker you should’t save cookie, it should be something that always be asked.

For example father accept age check but then you have his son goo and check history or go to your website and because his father accept age verification it shows adult content, or whatever is the information that needs to be adult.

Hi @Pealco hear what your saying. I think best compromise would be let the cookie stay on whatever machine for lets say 15mins. What would be the correct javascript ?. Sorry not a coder and heads puddled looking a javascript. Would you set it for var=date or do you need to get time, not to sure

Stephen

I’m not sure, but I think you can replace:

var year = 1000*60*60*24*365;

for:

var year = 1000*60*15;

I’m not on computer but I’m guessing it will work…

try it please… and let me know (for testing change 15 for 2 or 3 so you can try only with 2 or 3 minutes, and don’t need to wait 15 minutes…) :rofl: :rofl: :rofl:

This question may be best answered by Pealco, but I thought I’d post here for others to see if they have discovered a solution.

I’ve been using Pealco’s timed Modal popup using a cookie on one of my sites and it’s been working great up to this point. The code I’ve been using is shown at Pealco’s snippets site (https://blocs.webtekpc.pt/) with the snippet id:<modal_aut_cookies_24h_delay_5s> - “Open Modal Automatically with 5 seconds delay after page loads only once (Cookies), but after 24 hours it reloads again.”

The pop up modal works fine for the bootstrap 4 versions of my Blocs project, but doesn’t seems to work for bootstrap 5 versions of my Blocs project. I know it’s early days for bootstrap 5, but does anyone have any suggestions on how to make this work for bootstrap 5 Blocs projects?

Any suggestions are much appreciated.

Thx.

pruthe

Hi @Pealco I am really glad to see this thread and have been looking for a solution. I am working on a site for a client, when someone goes to the website a prompt (Modal pop-up dialogue box) needs to pop up immediately with 2 buttons: ‘Customer’ or ‘Consultant’.

If the visitor selects ‘Customer’ button, it goes to the customer section of the website. If one is a consultant and clicks on the ‘Consultant’ button it goes to the technical section of the site. A customer does not have access to the technical section but the consultant has access to the whole site. However, if the customer pretends to be a Consultant and clicks on the ‘Consultant’ button, then that person will have access to the technical section but then he or she is personally responsible for it.

The prompt (modal pop-up) should not be defeated if someone copies and pastes the URL of the technical section and pastes it in the browser.

Alternatively, I could have ‘Consultant’ in the the navigation bar, it could be linked to a page inside Blocs that behaves like a modal pop-up but then the problem is that someone could copy the URL and defeat the modal-like page. Any way to hide the URL to the technical section of the website?

Help from you or other members will be appreciated.

Hi @Flashman, those are rather nice. Would be nice to be able to add design elements to prompts / modal pop-ups. Maybe @Pealco will release such a bric in the future.

Could this be a feature added to Blocs do you think @Norm ?
Like a 1 time Modal auto trigger on a page? - be great for all kinds of things, promotions…reminders…sign up forms etc

1 Like