简体   繁体   中英

how to get iframe location url hash in href attr button?

So.. what i have in the current iframe src the default path /webrtcv2

<iframe id="videobox" width="270" height="410" frameborder="0" src="/webrtcv2" marginwidth="0"></iframe>

but when the user open the dialog box as you saw in the screen the iframe location generated this type of url https://absdefg.com/webrtcv2/#b2deb3 this is can be any random hash.. now what i need to do.. get the current link including the random hash to the invitation button href type

<a  class="link-id-videochat" href="https://absdefg.com/webrtcv2/#user-random-hash-here">Send invitation</a>        

another describe: i need to print the iframe location after get the hash /webrtcv2/#abce123 to -- > <a href="full iframe location including the hash here">Send invitation</a> i hope to get that by jquery...thanks

在此处输入图像描述

Given:

<a class="link-id-videochat" href="https://absdefg.com/webrtcv2/#b2deb3">Send invitation</a>       

Then use:

var url = $('.link-id-videochat').attr('href');
var id = url.split("#").pop();
console.log(id); # b2deb3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM