Switching tabs JavaScript -
Switching tabs JavaScript -
so rather tough explain, i'll seek best. have added event listeners on webpage bring pages press of key, , work fine. used code:
if(e.keycode === 65) window.location.replace('http://exampleurl.com/example'); and works fine. tried opening them new tabs this:
if(e.keycode === 65) window.open('http://exampleurl.com/example', '_newtab'); and fine. think annoying open new tab every time seek visit 1 of pages. create if have 1 page open in 1 tab, pressing key visit page switch tab open in. closest able doing this:
if(e.keycode === 65) window.open('http://exampleurl.com/example', '_newtab_home'); if(e.keycode === 66) window.open('http://anotherexampleurl.com/example2', '_newtab_home'); and open new url in same tab if you're in tab. won't switch tab. think works because when "_newtab_home" names tab , target open in tab. cool, , understand that, how create open tab whenever loads new url? want able open new tab locations haven't been visited, after visit them , seek go homepage ("http://exampleurl.com/example"), want switch tab open in. know there's way switch tabs in javascript using tab numbers, this:
var tabnum = 2; $('ul.quicktabs_tabs li.tab' + tabnum + ' a').trigger('keyup'); but rather without tab numbers numbers different depending on order user clicks them in, or whether or not have tabs open. don't know how though.
i think there 6 different locations can visit on site key presses. want each location have own tab open in , want switch tab whenever press key opens again. possible in javscript? if so, please help me out! in advance. (i'm sorry if question unclear, sense free comment , inquire questions it.)
didn´t find way check if window opened, there way of checking if tab opens windows has opened them storing references of tabs open:
html:
<input type='button' id='button' value='open' > js:
window.onload=function(){ function launchapplication(l_url, l_windowname) { if ( typeof launchapplication.winrefs == 'undefined' ) { launchapplication.winrefs = {}; } if ( typeof launchapplication.winrefs[l_windowname] == 'undefined' || launchapplication.winrefs[l_windowname].closed ) { launchapplication.winrefs[l_windowname] = window.open(l_url, l_windowname); } else { launchapplication.winrefs[l_windowname].focus() } } document.getelementbyid('button').addeventlistener('click', function(){ launchapplication('http://www.google.com', 'g') }); } fiddle: http://jsfiddle.net/zwnwskay/1/
javascript tabs
Comments
Post a Comment