How to inject javascript into a Webi report
Well it's quite easy! Let's say we want to display a message to the user every time he opens the report.
Step 1
The javascript is easy
Step 2
We open the document and add a blank cell somewhere in the report
Step 3
With the blank cell selected we go to Properties --> Display --> Read cell content as... and select HTML. By doing this we tell BO to treat whatever we write inside the blank cell as HTML. By default it treats it as it was simple text.
Step 4
We select the blank cell and write to the Formula Editor:
Then we press the validate button and save the report.
Step 6
Open the report (view) and the message we wrote in javascript appears!
Aesthetic Tip
Select the blank cell and remove the borders in order to make it "invisible" to the user's eye.
Step 1
The javascript is easy
Step 2
We open the document and add a blank cell somewhere in the report
Step 3
With the blank cell selected we go to Properties --> Display --> Read cell content as... and select HTML. By doing this we tell BO to treat whatever we write inside the blank cell as HTML. By default it treats it as it was simple text.
Step 2 and 3 |
We select the blank cell and write to the Formula Editor:
<script type="text/javascript">alert("Hello injection!!!");</script>
Step 5Then we press the validate button and save the report.
Step 4 and 5 |
Open the report (view) and the message we wrote in javascript appears!
Aesthetic Tip
Select the blank cell and remove the borders in order to make it "invisible" to the user's eye.
Great technique! Is there any way to delay the script execution until after user prompts have been selected?
ReplyDeleteI haven't tried that but I can't think an easy way to do that...
Delete