Forum Discussion

dundovic_25174's avatar
dundovic_25174
Icon for Nimbostratus rankNimbostratus
Apr 04, 2013

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

  • 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.
  • 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.

     

  • For some reason the code I'm trying to post gets malformed and captures resized (shrunk...)....

     

  • 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:

     
  • 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.