js跳轉(zhuǎn)到指定url的方法與實際使用
更新時間:2023年09月14日 08:57:18 作者:藍胖子的多啦A夢
這篇文章主要給大家介紹了關于js跳轉(zhuǎn)到指定url的方法與實際使用的相關資料,要實現(xiàn)JavaScript跳轉(zhuǎn)到指定URL,可以使用window.location對象來實現(xiàn),需要的朋友可以參考下
js跳轉(zhuǎn)到指定url
js怎么跳轉(zhuǎn)到指定url方法如下:
1、οnclick="javascript:window.location.href='URL'" 2、οnclick="location='URL'" 3、οnclick="window.location.href='URL?id=11'"
JS跳轉(zhuǎn)鏈接的幾種方式:
1、跳轉(zhuǎn)鏈接在當前窗口打開 window.location. rel="external nofollow" 等價于 <a href="baidu.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_self">go baidu</a> 2、跳轉(zhuǎn)鏈接 在新窗口打開 window.open("http://www.baidu.com") 等價于 <a href="baidu.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank">go baidu</a> 3、跳轉(zhuǎn)鏈接 返回上一頁 window.history.back(-1); 4、跳轉(zhuǎn)鏈接 self.location.href="baidu.com" rel="external nofollow" rel="external nofollow" rel="external nofollow"
實際使用
需求:頁面上點擊按鈕 需要調(diào)用設備提供的地址
<el-button v-if="showBtn" size="mini" type="primary" @click="towBtn('openDebugger')"> {{ $t("mlFive.openBugger") }} </el-button>
towBtn(e) { if (e == 'openDebugger') { location.href = "device://config" } else { location.href = "device://release" } },
總結(jié)
到此這篇關于js跳轉(zhuǎn)到指定url的方法與實際使用的文章就介紹到這了,更多相關js跳轉(zhuǎn)指定url內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:
相關文章
使用Plupload實現(xiàn)直接上傳附件至七牛云存儲
這篇文章主要介紹了使用Plupload實現(xiàn)直接上傳附件至七牛云存儲,需要的朋友可以參考下2014-12-12JavaScript定時器setTimeout、setInterval使用詳解
網(wǎng)站開發(fā)過程中經(jīng)常會用到各種各樣的定時任務,這時我們會用到setTimeout和setInterval方法,下面這篇文章主要給大家介紹了關于JavaScript定時器setTimeout、setInterval使用的相關資料,需要的朋友可以參考下2023-04-04