Hi
I found this piece of code:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
window.open("http://www.example.com/");
});
</script>that I placed in a block and set to only show on my front page and it works kind of. I want to know how I can display a node or the content of a node in a shadowbox when my front page loads for the first time and not load again until they visit the site again.
Is this possible with shadowbox?
Comments
Comment #1
nicholas.alipaz commentedYou will need to set a cookie in the user's browser using javascript. This isn't something that we will add to the module I am sure. I give you two references:
http://www.w3schools.com/JS/js_cookies.asp - Setting cookies with js
http://plugins.jquery.com/project/cookie - Setting cookies with jQuery if you feel the need to be a little more graceful with your code.
This solution would not necessarily track when their last visit was but do a simple cookie expiration based on a time period. This issue probably has a number of solutions, but a simple expirable cookie would likely be the easiest.
--
Los Angeles Web Design and development for Drupal.
Comment #2
wind_kind commentedthanks I'll have look at the links.
Comment #3
tmckeown commentedWhen ever I call shadowbox.open in some js tags I get the following javascript error: container is undefined. Any ideas on how to do this properly with shadowbox module that will not generate an error?
Comment #4
nicholas.alipaz commentedtmckeown, this is completely unrelated to this issue. Please open a new support request.
Comment #5
manfer commentedThat is an example on how to open a page in shadowbox programmatically on load. Notice we have to wait to onload event as on DOM ready -$(document).ready- it won't work (not sure but probably because on DOM ready the initialization of shadowbox is done so we have to wait for that).
All the rest is not something related to shadowbox. That's something to do somewhere out of the scope of shadowbox. To check for the first visit probably can be done just with session.