Question

I'm calling a webpage from a mobile device (a motorola MC55A0).
The browser is IEmobile.
The page has a button on it, a press on that button calls some javascript code ending with the line:

window.close();

The javascript executes fine until that line, where nothing happens.
The browser is expected to close but doesn't.

What could be the cause of that behavior?

EDIT: I would like to add that the same webpage worked on another mobile device, with Windows CE 5.0 (Motorola MC3000 series)

Was it helpful?

Solution

remember that: you can fire window.close() only on windows that have been opened with window.open()

See: Scripts may close only the windows that were opened by it

This method is only allowed to be called for windows that were opened by a script using the window.open method. If the window was not opened by a script, the following error appears in the JavaScript Console: Scripts may not close windows that were not opened by script.

that's the "nothing happens" you're facing. actually it's not absolutely nothing- a script message has been printed to the console.

hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top