Adding refresh button to URLWindow
|
|
Overview As part of my Prototype-UI testing I wanted to add a ‘refresh’ button to my URLWindows. This briefly explains how I went about it, and the results. Assumptions I’m using Rails on a Windows box for testing, and I’m using the ‘bluelighting’ window style. Adding the button graphic
Modifying the css
Note: Please note the -120px and -140px offset. This utilizes the 40 px of space you added to the ‘buttons-blue.gif’ above. Also note I renamed my gif to ‘buttons-blue_rev1.gif’. Adding the button to the URLWindow
Gotchas
Thanks! |
|
|
Refresh and Back Buttons using Prototype-UI URLWindow Prototype-UI uses iframes for the URLWindow class. When making custom refresh or back buttons, it is important to remember that you are restricted to working with pages that come from within your local site. If you try to access the URL location of a iframe pointing to something outside your site, you get an access denied error in many cases. Most browsers impliment this on purpose to prevent cross site scripting attacks. Below are the custom extensions to the URLWindow class I used to test with:
I then tested this code against an iframe pointing to a url contained within my local site. The results of testing is as follows: Safari: iframe back -> Broken Safari: iframe refresh current url location -> Works |
|
|
and what about refresh button to UI.Window which content is set by setAjaxContent? .addButton('refresh', refreshWindow(...))
but i receive error message:
this.setAjaxContent is not a function
refreshWindow()~sbak (line 219)
app_windows()~sbak (line 57)
wrapper(load )prototype.js (line 3877)
[Break on this error] this.setAjaxContent('sites/header.html');
is there sth like this.iframe.contentWindow.location.href stored for AjaxContent? //i’ve done it in a little different way- when i load from database adress of website to use in setAjaxContent, i save it to the array and re-use in refreshWindow. – it’s rather ‘back’ then ‘refresh’ now. |