Forum Discussion
Splashpage iRule and javascript
Is there any restriction on having 'javascript' code within the HTML splashpage iRule? I may require some mouse over image toggles implemented within the splashpage and would like to know if this is even supported within iRule.
Regards,
Sasha
7 Replies
- Kevin_Stewart
Employee
Not sure which HTML splashpage iRule you're referring to, but if it involves HTTP::respond, then there is no restriction at all. You can include just about anything (JS, CSS, images) in an HTML response. - dundovic_25174
Nimbostratus
Thanks for reply, Kevin. Sorry for formatting issues, I'm trying to post with images..... It involves HTTP:respond. I bumped into an error when trying to add some javascript functionality and started questioning if this is even supported. I've always used simple splashpage iRules such as in this example on 'snippet1.jpg'
Within the head section there was always plain HTML, but due to some specific request I tried to insert as described on 'snippet2.jpg'....and this is where iRule editor started reporting 'undefined procedure' errors on checkup. Due to the syntax and use of brackets in javascript, I started wondering if this is not compatible. Anybody here had successful implementation of javascript code in similar manner?
Regards,
S. - dundovic_25174
Nimbostratus
For some reason the code I'm trying to post gets malformed and captures resized (shrunk...)....
- dundovic_25174
Nimbostratus
...
- dundovic_25174
Nimbostratus
This is standard iRule:when HTTP_REQUEST { if { [HTTP::uri] equals "/image.png" } { if { [HTTP::header exists If-Modified-Since] } { HTTP::respond 304 noserver } else { HTTP::respond 200 content [b64decode "IMAGE_CONTENT_HERE"] noserver "Content-Type" "image/png" "Last-Modified""Mon, 01 Jan 2013 00:00:01 EDT" } } else { HTTP::respond 503 content " . . . . . . . . . . . . " noserver } }
This is inserted in head section and triggered errors: - Kevin_Stewart
Employee
You just need to escape any quotation marks and square brackets. - dundovic_25174
Nimbostratus
Thanks, Kevin! Actually, both square and curly brackets had to be escaped. That did the trick. Sometimes I cannot see the forest for the trees...
Regards,
S.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com