Passing arguments via URL when using HDViewSL
-
2009. július 22. 21:27
I am trying to use this tool and pass some parameters to my supporting javascript via URL.
As an example here is a Deep Zoom image
http://www.trappdf.com/public/666-LucidTrapTest.html
As part of this project I need to pass some variables to some javascript running on this page so I need the URL to be:
http://www.trappdf.com/public/666-LucidTrapTest.html?run=111&jobId=222
However when I add any arguments to the URL the HDViewSL stops working. Any ideas would be greatly appreciated!
David
Az összes válasz
-
2009. július 22. 22:21Thanks Eric for pointing out to me the following: (main problem now solved - still thinking about the Save specific View Button)
Take a look at the page source… this is the javascript that's causing trouble for you:
<script type="text/javascript">
var args;
if ( top.location.search == "" ) {
args = 'FileName=#hdvxmlembed&BackgroundColor=0&Viewer=1';
}
else {
args = top.location.search.substring(1);
}
hdv = new hdvHost("hdvControl", "hdvDiv", "100%", "100%", top.location.href, args);
</script>
The highlighted lines cause everything after the "?" in the current location URL to be passed to the hdvHost script that creates the HD View SL object. That's what enables the link given in the "Save Specific View" dialog to work. It looks like you don't want that to happen – instead you want HD View SL to always use the embedded XML to define the source of the image. You should get what you want if you take out the highlighted lines and leave the rest. In that case, I'd recommend removing the "Save Specific View" button as well.
If you want to keep the "Save Specific View" functionality and pass other parameters in the location URL, you'll have to do some work to combine HD View SL's parameters with your new parameters in any URL you give to the user. I can give suggestions, if that's what you want.