3.

【Javascriptエラー】Uncaught TypeError: location.href is not a function

編集

エラー内容

Uncaught TypeError: location.href is not a function

 

発生条件/原因/対処法

以下のような記述をしている際に発生するエラー。

(ちなみにInternet Explorerだとエラーは発生しない)

location.href(url)

()ではなく=にすることで正常に動作する。

location.href=url

 

編集
Post Share
子ページ

子ページはありません

同階層のページ
  1. Uncaught TypeError: Illegal invocation
  2. Form submission canceled because the form is not connected
  3. Uncaught TypeError: location.href is not a function
  4. Access to XMLHttpRequest at 'url1' from origin 'url2' has been blocked by CORS policy
  5. Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')