本文整理了Java中com.gargoylesoftware.htmlunit.javascript.host.Window.getBrowserVersion()
方法的一些代码示例,展示了Window.getBrowserVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getBrowserVersion()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.javascript.host.Window
类名称:Window
方法名:getBrowserVersion
暂无
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Returns the {@code offscreenBuffering} property.
* @return the {@code offscreenBuffering} property
*/
@JsxGetter({CHROME, IE})
public Object getOffscreenBuffering() {
if (getBrowserVersion().hasFeature(JS_WINDOW_FRAMES_ACCESSIBLE_BY_ID)) {
return "auto";
}
return true;
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* {@inheritDoc}
*/
public Scriptable construct(final Context cx, final Scriptable scope, final Object[] args) {
if (!getBrowserVersion().isIE()) {
throw Context.reportRuntimeError("Window is not a function.");
}
return null;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Gets the browser version currently used.
* @return the browser version
*/
public BrowserVersion getBrowserVersion() {
Scriptable parent = getParentScope();
while (!(parent instanceof Window)) {
parent = parent.getParentScope();
}
return ((Window) parent).getBrowserVersion();
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Sets the value of the {@code top} property.
* @param o the new value
*/
@JsxSetter
public void setTop(final Object o) {
if (getBrowserVersion().hasFeature(JS_WINDOW_TOP_WRITABLE)) {
top_ = o;
}
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Returns the {@code offscreenBuffering} property.
* @return the {@code offscreenBuffering} property
*/
@JsxGetter({CHROME, IE})
public Object getOffscreenBuffering() {
if (getBrowserVersion().hasFeature(JS_WINDOW_FRAMES_ACCESSIBLE_BY_ID)) {
return "auto";
}
return true;
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Gets the browser version currently used.
* @return the browser version
*/
public BrowserVersion getBrowserVersion() {
Scriptable parent = getParentScope();
while (!(parent instanceof Window)) {
parent = parent.getParentScope();
}
return ((Window) parent).getBrowserVersion();
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Sets the value of the {@code top} property.
* @param o the new value
*/
@JsxSetter
public void setTop(final Object o) {
if (getBrowserVersion().hasFeature(JS_WINDOW_TOP_WRITABLE)) {
top_ = o;
}
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Gets the major version of the scripting engine.
* @see <a href="http://msdn.microsoft.com/en-us/library/x7cbaet3.aspx">MSDN doc</a>
* @return the major version
*/
@JsxFunction(IE)
public int ScriptEngineMajorVersion() {
return getBrowserVersion().getBrowserVersionNumeric();
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* {@inheritDoc}
*/
public Scriptable construct(final Context cx, final Scriptable scope, final Object[] args) {
if (!getBrowserVersion().isIE()) {
throw Context.reportRuntimeError("Window is not a function.");
}
return null;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Gets the major version of the scripting engine.
* @see <a href="http://msdn.microsoft.com/en-us/library/x7cbaet3.aspx">MSDN doc</a>
* @return the major version
*/
@JsxFunction(value = IE, functionName = "ScriptEngineMajorVersion")
public int scriptEngineMajorVersion() {
return getBrowserVersion().getBrowserVersionNumeric();
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* {@inheritDoc}
*/
public Scriptable construct(final Context cx, final Scriptable scope, final Object[] args) {
if (!getBrowserVersion().isIE()) {
throw Context.reportRuntimeError("Window is not a function.");
}
return null;
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Sets the {@code opener} property.
* @param newValue the new value
*/
@JsxSetter
public void setOpener(final Object newValue) {
if (getBrowserVersion().hasFeature(JS_WINDOW_CHANGE_OPENER_ONLY_WINDOW_OBJECT)
&& newValue != null && newValue != Undefined.instance && !(newValue instanceof Window)) {
throw Context.reportRuntimeError("Can't set opener to something other than a window!");
}
opener_ = newValue;
}
代码示例来源:origin: org.jenkins-ci/htmlunit
private Object getHandlerForJavaScript(final String eventName) {
Object handler = getEventListenersContainer().getEventHandlerProp(eventName);
if (handler == null && !getBrowserVersion().isIE()) {
handler = Scriptable.NOT_FOUND;
}
return handler;
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
private Object getHandlerForJavaScript(final String eventName) {
Object handler = getEventListenersContainer().getEventHandlerProp(eventName);
if (handler == null && !getBrowserVersion().isIE()) {
handler = Scriptable.NOT_FOUND;
}
return handler;
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
private Object getHandlerForJavaScript(final String eventName) {
Object handler = getEventListenersContainer().getEventHandlerProp(eventName);
if (handler == null && !getBrowserVersion().isIE()) {
handler = Scriptable.NOT_FOUND;
}
return handler;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Sets the {@code opener} property.
* @param newValue the new value
*/
@JsxSetter
public void setOpener(final Object newValue) {
if (getBrowserVersion().hasFeature(JS_WINDOW_CHANGE_OPENER_ONLY_WINDOW_OBJECT)
&& newValue != null && newValue != Undefined.instance && !(newValue instanceof Window)) {
throw Context.reportRuntimeError("Can't set opener to something other than a window!");
}
opener_ = newValue;
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* {@inheritDoc}
*/
public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) {
if (!getBrowserVersion().isIE()) {
throw Context.reportRuntimeError("Window is not a function.");
}
if (args.length > 0) {
final Object arg = args[0];
if (arg instanceof String) {
return ScriptableObject.getProperty(this, (String) arg);
}
else if (arg instanceof Number) {
return ScriptableObject.getProperty(this, ((Number) arg).intValue());
}
}
return Context.getUndefinedValue();
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* {@inheritDoc}
*/
public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) {
if (!getBrowserVersion().isIE()) {
throw Context.reportRuntimeError("Window is not a function.");
}
if (args.length > 0) {
final Object arg = args[0];
if (arg instanceof String) {
return ScriptableObject.getProperty(this, (String) arg);
}
else if (arg instanceof Number) {
return ScriptableObject.getProperty(this, ((Number) arg).intValue());
}
}
return Context.getUndefinedValue();
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Returns the current selection.
* @return the current selection
*/
@JsxFunction
public Selection getSelection() {
final WebWindow webWindow = getWebWindow();
// return null if the window is in a frame that is not displayed
if (webWindow instanceof FrameWindow) {
final FrameWindow frameWindow = (FrameWindow) webWindow;
if (getBrowserVersion().hasFeature(JS_WINDOW_SELECTION_NULL_IF_INVISIBLE)
&& !frameWindow.getFrameElement().isDisplayed()) {
return null;
}
}
return getSelectionImpl();
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Returns the current selection.
* @return the current selection
*/
@JsxFunction
public Selection getSelection() {
final WebWindow webWindow = getWebWindow();
// return null if the window is in a frame that is not displayed
if (webWindow instanceof FrameWindow) {
final FrameWindow frameWindow = (FrameWindow) webWindow;
if (getBrowserVersion().hasFeature(JS_WINDOW_SELECTION_NULL_IF_INVISIBLE)
&& !frameWindow.getFrameElement().isDisplayed()) {
return null;
}
}
return getSelectionImpl();
}
内容来源于网络,如有侵权,请联系作者删除!