Skip to content

Add can-lock-orientation media feature to detect if locking is possible #206

@makotokato

Description

@makotokato

(If this is already discussed, please close this)

When I look this spec, I cannot find feature detection section. Even If orientation.lock isn't supported, Blink and Gecko have this method in orientation. Then when calling it, NotSupportedError is throw if browser doesn't support it.

For feature detection of orientation.lock, is there a way of feature detection without using orientation.lock like following? And I hope that we add feature detection section for lock.

async function isLockSupport() {
  try {
    await orientation.lock('any');
    orientation.unlock();
    return true;
  } catch (e) {
  }
  return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions