Click here to Skip to main content
15,887,404 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, coding guys,

As you saw in the title, my cursor is not changing in iframe. This is the function in the script that adds the specific cursor in my iframe:

script.js
function addDefaultToIframes() {
	try {
		globalStyle = document.createElement("style")
		globalStyle.innerText = "* {cursor: url(https://gild.rixthetyrunt.repl.co/cursor.png), url(https://gild.rixthetyrunt.repl.co/cursor.cur), default !important;} *:not(input, *[contenteditable='true']) {user-select: none;}"
		document.getElementById("appFrame").contentWindow.document.onload = function() {
			document.getElementById("appFrame").contentWindow.document.head.appendChild(globalStyle)
			document.getElementById("appFrame").contentWindow.document.querySelector("*").style.cursor = "url(https://gild.rixthetyrunt.repl.co/cursor.png), url(https://gild.rixthetyrunt.repl.co/cursor.cur), default !important;"
			document.getElementById("appFrame").contentWindow.document.querySelector("*:not(input, *[contenteditable='true'])").style.userSelect = "none"
		}
		setTimeout(function() {addDefaultToIframes()}, 1)
	} catch (err) {
		console.log("Captured error: " + err.toString())
	}
}


I don't know why is the pre acting weird

And, it doesn't result in a change nor an error.

What I have tried:

                              
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900