Error Window Location Href Is Not A Function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow
$window.location.href Is Not A Function Angularjs
the company Business Learn more about hiring developers or posting ads with us Stack window.location.href is not a function chrome Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of angular $window.location.href is not a function 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up string is not a function on window location href [duplicate] up vote 14 down vote favorite 1 This
Window.location.href Not Working In Javascript
question already has an answer here: How to redirect to another page in jQuery? 60 answers $('.b').click(function(){ var link = 'www.yahoo.com'; window.location.href(link); }); I expect it to open www.yahoo.com but it says string is not a function? http://jsfiddle.net/V9Xat/ javascript jquery share|improve this question asked Jul 9 '14 at 9:36 user3522457 3923718 marked as duplicate by Satpaljavascript Users with the javascript badge can single-handedly close javascript questions as duplicates and reopen them as
Uncaught Typeerror: Window.location Is Not A Function
needed. Jul 9 '14 at 9:42 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. stackoverflow.com/questions/503093/… –Govind Singh Nagarkoti Jul 9 '14 at 9:54 add a comment| 4 Answers 4 active oldest votes up vote 18 down vote accepted Try- window.location.href = link; or window.location.assign(link); JSFiddle Check out the syntax of window.location here. share|improve this answer edited Dec 15 '15 at 15:31 Lawrence Cherone 21.4k42455 answered Jul 9 '14 at 9:37 Sahil Mittal 17.3k103667 Come on.. Explanation, link to API... Something ... –Florian F. Jul 9 '14 at 9:38 @FlorianF., of course! :) –Sahil Mittal Jul 9 '14 at 9:39 add a comment| up vote 3 down vote try using window.location.href = link; MDN source share|improve this answer answered Jul 9 '14 at 9:38 Yaje 1,751722 add a comment| up vote 0 down vote window.location.href = link; Use this. share|improve this answer answered Jul 9 '14 at 9:37 Deepak Tiwari 2,4881518 add a comment| up vote 0 down vote Either use : window.location.href = link; or with .replace() window.location.replace(link); share|improve this answer answered Jul 9 '14 at 9:38 Jai 51.9k63558 add a comment| Not the answer you're looking for? Browse other questi
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business window.location.href not working in firefox Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
Uncaught Typeerror: Window.location.href Is Not A Function
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like window.location.href not working in chrome you, helping each other. Join them; it only takes a minute: Sign up window.location.href not working in form onsubmit up vote 6 down vote favorite 3 So i have a form, and onsubmit="return reg_check(this)" where reg_check() is http://stackoverflow.com/questions/24650136/string-is-not-a-function-on-window-location-href a javascript function in the header which is supposed to check the form data, and since one of its tasks is to check if the username is in the database which requires php, i want to redirect to a php page that does this task. Problem is: window.location.href is not working! Here's the function (reduced version) and of course the main.php is just a random page i got: function reg_check(myForm) { alert("before redirect.."); window.location.href = "http://localhost/main.php?width=" http://stackoverflow.com/questions/6109527/window-location-href-not-working-in-form-onsubmit + screen.width + "&height=" + screen.height; alert("after redirect.."); } The before redirect and after redirect alerts work, it just doesn't redirect? It remains in the same page. Also, if I tried to redirect from the body by just typing : it redirects. Any ideas of how I could get this to work? javascript share|improve this question edited May 14 at 16:53 Rejith R Krishnan 10.4k41436 asked May 24 '11 at 11:13 Noura 67126 add a comment| 3 Answers 3 active oldest votes up vote 28 down vote accepted You need to return false; from your reg_check function and then in your onsubmit, change it to: onsubmit="return reg_check(this);" This will cancel the form submission. And if you want to let the form submit as normal, just return true from reg_check. Edit (to be more clear you need to add return false; from your function): function reg_check(myForm) { alert("before redirect.."); window.location.href = "http://localhost/main.php?width=" + screen.width + "&height=" + screen.height; return false; } share|improve this answer edited May 24 '11 at 12:12 answered May 24 '11 at 11:41 Craig 4,01812040 1 hmm thanks for the tip but it still doesn't work –Noura May 24 '11 at 11:52 @Nara sorry didn't say that correctly, I've updated the answer an
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post http://www.codeproject.com/Questions/425210/window-location-href-not-working-in-Chrome your Blog quick answersQ&A Ask a Question View Unanswered Questions View https://developer.mozilla.org/en-US/docs/Web/API/Window/location All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / is not STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product is not a Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ window.location.href not working in Chrome Rate this: Please Sign up or sign in to vote. See more: Javascript Hi all, window.location.href (or) document.location.href is not working in Chrome. Is there any alternation? Please help me its urgent. I had searched in google but I din't get exactly. Thanks... Posted 20-Jul-12 2:04am Venkat_C6788 Add a Solution Comments AlluvialDeposit 20-Jul-12 8:06am what happens if you run the code in chrome? javascript-error? nothing? Venkat_C6 20-Jul-12 8:08am nothng Venkat_C6 20-Jul-12 8:34am Hey I got it. I gave setTimeOut with
& Guides Learn the Web Tutorials References Developer Guides Accessibility Game development ...more docs Mozilla Docs Add-ons Firefox WebExtensions Developer ToolsFeedback Get Firefox help Get web development help Join the MDN community Report a content problem Report a bug Search Search Languages Español (es) Français (fr) 日本語 (ja) 한국어 (ko) Português (do Brasil) (pt-BR) Русский (ru) 中文 (简体) (zh-CN) 正體中文 (繁體) (zh-TW) Add a translation Edit Advanced Advanced History Print this article MDN Web technology For developers Web APIs Window Window.location Your Search Results m_gol teoli jsx sdir456 Brettz9 Noitidart fscholz cta cpigat Krinkle darlesson fusionchess therealklanni lborgman charmander fkling42 cvr_hulu marquete kscarfone utkarsh_shah akoenig Mkmelin pablofiumara johnwilander charliekilian evilpie briankuhn Sheppy silverwind mattbasta Bzbarsky tarekcorp jacefarm dbruant minitech abhisekp myakura Kenneth tjcrowder ienzam louisremi pmorris grendel Günther masondesu Nickolay Inonit Sephr Dinomite Tobu Nemon Mgjbot Potappo Arend dalbani Kray2 BenoitL IdiosMachi RobG Callek Dria JesseW Window.location In This Article SyntaxExamplesBasic ExampleExample #1: Navigate to a new pageExample #2: Force reloading the current page from the serverExample #3Example #4: Display the properties of the current URL in an alert dialog:Example #5: Send a string of data to the server by modifying the search property:Example #6: Using bookmarks without changing the hash property:SpecificationsBrowser compatibilitySee also The Window.location read-only property returns a Location object with information about the current location of the document. Though Window.location is a read-only Location object, you can also assign a DOMString to it. This means that you can work with location as if it were a string in