Question: > 
> Let $C$ and $D$ be matrices such that $DC$ and $CD$ are square matrices of the same dimension. How can one prove that $\det(I-CD)=\det(I-DC)$?
> 
> 
> 

This is my approach to the question. I am not sure whether it is a correct one.

> 
> Let $ x $ be the eigenvalue of the matrix CD with the eigenvector $\textbf{v}$. Then $CD\textbf{v}=x\textbf{v}$. Now let $\textbf{y} = D\textbf{v}$. Then $ DC\textbf{y}=DCD\textbf{v}=xD\textbf{v} =x\textbf{y}$. This shows that $\textbf{y}$ is the eigenvector of $DC$ with the eigenvalue $x$.
> 
> 
> Now $DC\textbf{y}=xD\textbf{v}$ is non-zero if and only if $x$ and $D\textbf{v}$ are non-zero. This implies that $DC$ and $CD$ have the same non-zero eigenvalues, which also means that $\phi (CD, x)= \phi (DC, x) $ provided $x \neq 0$. Considering the case where $x=1$ we have the required results, because $ \det(I -CD) =\phi (CD, 1)= \phi (DC, 1) = \det(I -DC)$.
> 
> 
>

Answer: 
This is simply an instance of the [Sylvester determinant theorem](https://en.wikipedia.org/wiki/Sylvester%27s_determinant_theorem). A proof via block matrices is given in the link.

Your approach, however, will certainly do. In particular, note that $CD$ and $DC$ having the same non-zero eigenvalues means precisely that for $t \neq 0$, we have
$$
\det(tI - CD) = 0 \iff \det(tI - DC) = 0
$$
This (along with the observation that both polynomials are monic and of the same degree) is sufficient to deduce that the two characteristic polynomials are the same. From there, "plug in" $t = 1$.
If $C$ and $D$ are invertible observe that $$I-CD=C(C^{-1}-D)$$ and $$I-DC=(C^{-1}-D)C.$$ Then apply the rule $\det(AB)=\det(BA)$.

Then (as Omnom points out) you can use the fact that invertible $(n\times n)$-matrices are dense in the space of $(n\times n)$-matrices, and that $\det:\mathbb{R}^{n^2}\to\mathbb{R}$ is just a polynomial hence continuous.