简体   繁体   中英

Javascript not working in edge, but fine in Firefox, Chrome

I wrote a JavaScript function to get the current logged in user from any page on our SharePoint site and add it to a redirect call so I can make apps that only logged in SP users can access.

 <script>

 function init(){
 var divv = document.getElementById('SuiteNavUserName').innerHTML;
 var UN;
 UN = "http://subsite.comapny.org/application/from_sharepoint.aspx?usr=" + divv;
 window.location = UN;
 }
 t = setTimeout("init()",3000);
 </script>

Unfortunately, edge never redirects. Any idea what Edge does not like about my script? I'd test it, but the PC I'm on is running win 7 and thus no Edge to play with.

将 .href 添加到 window.location 得到:window.location.href

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