The $.mobile.base
object provides the reference to the original document base. You can set a custom value on the base object using the set()
method. You can use the reset()
method to revert to the original value. This recipe shows you how to use these utility methods.
Copy the full code of this recipe from the code/09/base
source folder. You can launch this code by using the URL: http://localhost:8080/09/base/main.html
.
Create
main.html
with two buttons, as shown in the following code snippet:<div id="content" data-role="content"> <div id="dispdiv"></div> <button id="changebtn">Set Document Base</button> <button id="resetbtn">Reset Document Base</button> </div>
Add the following script to display the document base object values:
function disp() { var str = "<p>Original Document Base: " + $.mobile.getDocumentBase() + "</p>" + "<p>Document Base set to : " + $.mobile...