Forum Discussion

Gurdip_Sira_160's avatar
Gurdip_Sira_160
Icon for Nimbostratus rankNimbostratus
Jul 05, 2016

Replace html with different code using STREAM

Hi All,

I want to implement javascript into my SharePoint application. I have a good steer in the right direction from a contribution from an earlier thread I posted:

when HTTP_REQUEST {
     Disable the stream filter for all requests
   set path [HTTP::path]    
   STREAM::disable


     LTM does not decompress response content, so if the server has compression enabled
     and it cannot be disabled on the server, we can prevent the server from sending
     a compressed response by removing the compression offerings from the client
    HTTP::header remove "Accept-Encoding"


} 
when HTTP_RESPONSE {
     Check if response type is text
    if { [HTTP::header value Content-Type] contains "text" and !([class match [string tolower $path] ends_with SPFileExtensions]) } {

         Define the stream replacement
        STREAM::expression {@

         Enable the stream filter for this response only
        STREAM::enable
    }
}

What I've noticed is that the javascript (omitted for brevity) gets embedded above the rest of the native javascript in SharePoint pages. I'd like to replace the existing javascript (about 20 lines) with a replacement that includes the same 50 lines of javascript + my additional script. However, as there are quotation marks in the script lines, I can't seem to save this to a variable.

                        









Is there an elegant way to do this? The iRule itself works but I need to investigate different approaches for F5 compatibility.