javascript - Use current web directory when navigating to page or url -
i'm updating old web app (webforms) works in ie 6-9. not written me. also, i'm not expert @ web development, solution might simple.
one issue extensive use of window.showmodaldialog
, ie specific call opens new browser window disables browser window opened it, popup message. has been replaced jquery modal dialog, there's issue 'url' gets passed it.
here's simplified reproduction of issue. there's javascript function takes url , id.
function openedit(url, id) { ...
this function existed in original version, except had code open modal popup window. replaced necessary jquery. however, url
value gets passed in doesn't have enough information. also, assume have no control on value gets passed here.
let's main page @ localhost/testsite/main.aspx
. there number of frames within page display other pages, localhost/testsite/products/productlist.aspx
- clicking item on page might open window localhost/testsite/products/productdetails.aspx
. there hundreds of pages follow general format.
sometimes url
has value of '/testsite/products/productdetails.aspx'. jquery dialog correctly navigates localhost/testsite/products/productdetails.aspx
however, other pages pass in name of page, 'productdetails.aspx', jquery tries find @ localhost/testsite/productdetails.aspx
. works on ie using window.showmodaldialog
, browser able expected directory of 'product' because it's same directory open window call made from. jquery doesn't seem make leap.
now, have possible solution using window.location
current url, parse bit, , generate valid url. i'm worried fringe cases may create, though, , seemed improper way it.
is there way have jquery open dialog using corrent directory, or there way generate current directory use doesn't involve window.location
? or best choice.
Comments
Post a Comment