25-Jan-2021 07:38
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.
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]"
}
}
28-Jan-2021
07:52
- last edited on
04-Jun-2023
21:05
by
JimmyPackets
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]"
}
}
28-Jan-2021 10:25
it works, thanks a lot for your help. i appreciate it, thanks again.