简体   繁体   English

如何在 href attr 按钮中获取 iframe 位置 url hash ?

[英]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 src 中拥有的默认路径 /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 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. .获取当前链接,包括随机 hash 到邀请按钮 href 类型

<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 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 ...谢谢

在此处输入图像描述

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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