js跳轉到指定url的方法與實際使用
更新時間:2023年09月14日 08:57:18 作者:藍胖子的多啦A夢
這篇文章主要給大家介紹了關于js跳轉到指定url的方法與實際使用的相關資料,要實現(xiàn)JavaScript跳轉到指定URL,可以使用window.location對象來實現(xiàn),需要的朋友可以參考下
js跳轉到指定url
js怎么跳轉到指定url方法如下:
1、οnclick="javascript:window.location.href='URL'" 2、οnclick="location='URL'" 3、οnclick="window.location.href='URL?id=11'"
JS跳轉鏈接的幾種方式:
1、跳轉鏈接在當前窗口打開
window.location. rel="external nofollow"
等價于
<a href="baidu.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_self">go baidu</a>
2、跳轉鏈接 在新窗口打開
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、跳轉鏈接 返回上一頁
window.history.back(-1);
4、跳轉鏈接
self.location.href="baidu.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" 實際使用
需求:頁面上點擊按鈕 需要調用設備提供的地址


<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"
}
},總結
到此這篇關于js跳轉到指定url的方法與實際使用的文章就介紹到這了,更多相關js跳轉指定url內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:
相關文章
詳述 Sublime Text 打開 GBK 格式中文亂碼的解決方法
這篇文章主要介紹了詳述 Sublime Text 打開 GBK 格式中文亂碼的解決方法,非常具有實用價值,需要的朋友可以參考下2017-10-10
基于JavaScript實現(xiàn)添加到購物車效果附源碼下載
這篇文章主要介紹了基于JavaScript實現(xiàn)添加到購物車效果附源碼下載的相關資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08
用JS提交參數(shù)創(chuàng)建form表單在FireFox中遇到的問題
在一個前端頁面上,需要通過JavaScript來提交參數(shù),使用JS創(chuàng)建form表單,將參數(shù)append到表單中進行提交,接下來將介紹如何操作與實現(xiàn)2013-01-01
JavaScript?字符串新增方法?trim()?的使用說明
這篇文章主要介紹了JavaScript字符串新增方法trim()的使用說明,文章圍繞主題展開詳細的內容介紹,具有一定的參考價值,需要的朋友可以參考一下2022-09-09
JS+CSS實現(xiàn)Div彈出窗口同時背景變暗的方法
這篇文章主要介紹了JS+CSS實現(xiàn)Div彈出窗口同時背景變暗的方法,是一款比較典型的javascript操作彈出窗口的技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-03-03

