Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

getOwnPropertyNames in IE

Posted on 2014-01-30
2
Medium Priority
?
544 Views
Last Modified: 2014-01-30
Hi,

I am using these functions to check the querystring for parameters and their values and then loop through and pass them to another function.
However, IE doesn't like getOwnPropertyNames. Is there an alternative I can use?

setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	if(typeof Object.getOwnPropertyNames(params).length !== 0){
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

getUrlVars = function() {
	var search = window.location.search;
    var params = {};
	if (search.charAt( 0 ) == '?' ) {
		search = search.substring(1);
        var hashes = search.split('&');
        var i,len = hashes.length;
        for(i = 0; i < len; i+=1) {
          hash = hashes[i].split('=');
          params[hash[0]] = hash[1];
	 }
  }
  return params;
}

Open in new window

0
Comment
Question by:Al4ddin2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39820730
Try this :
setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	var l = 0;
	for(var i in params) l++;
	if(l) {
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39820791
Another one :
setTrackParams = function(){
	var params = qbtbUS.getUrlVars();
	var forms = $("form");

	for(var i in params) break;
	if(i) {
		$.each( forms, function( key, value ) {
			qbtbUS.createSubmitFields(value, params);
		});
	}
}

Open in new window

0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question