Get HTML Current Page name alone, followed by ".htm" from URL or Pathname using Jquery & Javascript -


i have scenario like: below,

following "menu list" having href value set corresponding ".htm" pages inside "menu.html"

  1. click me got pageone.htm
  2. click me got pagetwo.htm
  3. click me got pagethree.htm
  4. click me got pagefour.htm

each pages pageone.htm, pagetwo.htm & pagethree.htm etc.. having footer part, in footer must has contain 3 links href values.

i require solution: if current page pageone.htm footer should show me shortcuts links pagetwo.htm, pagethree.htm , pagefour.htm , wise verse depending on current page.

so require code .htm url pathname.

can find() method of jquery after getting url path find(".htm") url.

require snippet of code .htm page name alone.

including sample case below:

what if url >> "http://<10.10.21.26:9080>/mytestaoo/pagethree.htm#detailview"

i wish value "pagethree.htm" alone above url, if current page.

thanks in advance

var lastpartofurl = document.url.split('/').pop(); 

or regular expression:

var regexp = /([^\/]+)(.htm)/; var match = regexp.exec(document.url); console.log(match[0]); // pagethree.htm console.log(match[1]); // pagethree console.log(match[2]); // .htm 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -