hyperlink - Verify href with Javascript? -
hyperlink - Verify href with Javascript? -
in online shop have links in product pages go template user can download. unfortunately, have many of these links, broken, because file missing.
is there function, preferably in javascript, allows me check if link correct? if it's ok, "continue linking" allow download, , if it's broken, show alert says "uh, file missing, please study clicking here"
since javascript won't have access server's file system, believe need server-side code. easy way of accomplishing write web service accepts filename(string). have homecoming boolean. this:
[webmethod] public bool checkfile(string filename) { homecoming file.exists(filename); }
then, when clicks link, can phone call webservice , write callbackfunction evaluates returned value. if it's true, execute logic (presumably) have. if it's false, can pop modal informing them file no longer exists on server.
javascript hyperlink href verify
Comments
Post a Comment