Software Archive
Read-only legacy content
17060 Discussions

document.location.hash empty in emulator

Elvis_J_
Beginner
762 Views

I used "document.location.hash" to pass parameter to dynamic created panels and it works fine in release 1995 (both in emulator and my Android pad Intel App Preview). However, I noticed that the value of "document.location.hash" in the emulator became empty and caused my code not working correctly after upgrade to release 2170. But the same code still works well when I used "Intel App Preview" in my Android pad to run the program. Is the emulator cancel the support of  "document.location.hash" or something wrong with it? Thank you!

0 Kudos
2 Replies
Swati_S_Intel1
Employee
762 Views

There was an issue in node webkit with setting relative location using document.location.href a while back. That was fixed a long time ago. Recently we have updated nw, I'm not sure if what you are seeing is a side effect of that. Can you describe your issue little more? What you mean by value of "document.location.hash" in the emulator became empty?

Can you post the snippet of the code that's having issue? Thanks.

0 Kudos
Elvis_J_
Beginner
762 Views

Thank you for the prompt reply. Here are my code to use document.location.hash value: Actually, not only hash used in my code are empty (see line 5 in the image), all the hashes are empty string now. Thank you!

for (var i=0; i<venderArray.length; i++) {
        var liHtml = '<li><a href="#'+venderArray._id+'/'+venderArray.username+'">'; 
        liHtml += '<div  id="'+venderArray.username+'" class="list-text">';
        liHtml += '</a></li>';
        $(".list").append(liHtml);
                
        var panel_html = '<p>'+venderArray.nickname+'</p>';
        panel_html += '<p>'+venderArray.address+'</p>';
        panel_html += '<p>'+venderArray.tel+'</p>';
        panel_html += '<ul class="list" id="menu_of_vender_list"> </ul>';
        $.ui.addContentDiv(venderArray._id, panel_html, "Vender Detail");

        $("#"+venderArray._id).unbind("loadpanel");
        $("#"+venderArray._id).bind("loadpanel",function(evt){
            var url=document.location.hash.replace("#"+evt.target.id+"/","");       
            var params=url.split("/");
            var tmpString = params.toString();
            getMenuItem(tmpString);
        });            
    }

The snapshot in the debug window: 

0 Kudos
Reply