cancel
Showing results for 
Search instead for 
Did you mean: 

irule to popup the message before continue to page.

Hien_Truong
Cirrus
Cirrus

i have a below irule to popup the message window before to continue to the page. there are two issue what i don't know how to correct it.

  • the message doesn't go away after 5 seconds to the page www.abc/def.
  • The message is not popup again after the first time to enter the page www.abc/def. I have to clear the cache to popup the message again when go to other page www.abc/xyz.

Any help i appreciate it.

 

The below is irule:

 

when RULE_INIT {

set static::refresh_time 5

set static::notification_page {

   

System Notification

  

Bookmark the new home: http://www.abc.com/home.

 

This message will close in $static::refresh_time seconds to continue.

 

}  

}

when HTTP_REQUEST {

if { ( [HTTP::uri] eq "/def.html") and (not [HTTP::cookie exists NotificationDone]) } {

HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=1; path=/; domain=.[HTTP::host]"

}

elseif { ( [HTTP::uri] eq "/xyz.html") and (not [HTTP::cookie exists NotificationDone]) } {

HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=1; path=/; domain=.[HTTP::host]"

}

}

 

2 REPLIES 2

iaine
MVP
MVP

Hi

 

Try something like this

 

when RULE_INIT {   set static::refresh_time 5 set static::notification_page {   <html> <head> <meta http-equiv="refresh" content="$static::refresh_time;url=$original_uri" /> </head> <body> <br> System Notification<br> <br> Bookmark the new home: http://www.abc.com/home.<br> <br> This message will close in $static::refresh_time seconds to continue.<br> </body> </html>   } }   when HTTP_REQUEST {   if { ( [HTTP::uri] eq "/def.html") and (not [HTTP::cookie exists NotificationDone]) } { set original_uri [HTTP::uri] HTTP::respond 200 content [subst $static::notification_page] "Mime-Type" "text/html" "Set-Cookie" "NotificationDone=1; path=/; domain=[HTTP::host]"   } elseif { ( [HTTP::uri] eq "/xyz.html") and (not [HTTP::cookie exists NotificationDone2]) } { set original_uri [HTTP::uri] HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" "Set-Cookie" "NotificationDone2=1; path=/; domain=[HTTP::host]" } }

 

Hien_Truong
Cirrus
Cirrus

it works, thanks a lot for your help. i appreciate it, thanks again.