/** * Returns the pathname portion of the location URL. * @return the pathname portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a> */ public String jsxGet_pathname() { if (WebClient.URL_ABOUT_BLANK == getUrl()) { if (getBrowserVersion().isFirefox()) { return ""; } return "/blank"; } return getUrl().getPath(); }
/** * Returns the pathname portion of the location URL. * @return the pathname portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a> */ public String jsxGet_pathname() { if (WebClient.URL_ABOUT_BLANK == getUrl()) { if (getBrowserVersion().isFirefox()) { return ""; } return "/blank"; } return getUrl().getPath(); }
/** * Returns the pathname portion of the location URL. * @return the pathname portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a> */ public String jsxGet_pathname() { if (WebClient.URL_ABOUT_BLANK == getUrl()) { if (getBrowserVersion().isFirefox()) { return ""; } return "/blank"; } return getUrl().getPath(); }
/** * Sets the hash portion of the location URL (the portion following the '#'). * * @param hash the new hash portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a> */ public void jsxSet_hash(String hash) { // IMPORTANT: This method must not call setUrl(), because // we must not hit the server just to change the hash! try { if (hash != null) { if (hash.startsWith("#")) { hash = hash.substring(1); } final boolean decodeHash = !getBrowserVersion().isIE(); if (decodeHash) { hash = URIUtil.decode(hash); } hash_ = hash; } else { hash_ = null; } } catch (final URIException e) { LOG.error(e.getMessage(), e); } }
/** * Sets the hash portion of the location URL (the portion following the '#'). * * @param hash the new hash portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a> */ public void jsxSet_hash(String hash) { // IMPORTANT: This method must not call setUrl(), because // we must not hit the server just to change the hash! try { if (hash != null) { if (hash.startsWith("#")) { hash = hash.substring(1); } final boolean decodeHash = !getBrowserVersion().isIE(); if (decodeHash) { hash = URIUtil.decode(hash); } hash_ = hash; } else { hash_ = null; } } catch (final URIException e) { LOG.error(e.getMessage(), e); } }
/** * Sets the hash portion of the location URL (the portion following the '#'). * * @param hash the new hash portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a> */ public void jsxSet_hash(String hash) { // IMPORTANT: This method must not call setUrl(), because // we must not hit the server just to change the hash! try { if (hash != null) { if (hash.startsWith("#")) { hash = hash.substring(1); } final boolean decodeHash = !getBrowserVersion().isIE(); if (decodeHash) { hash = URIUtil.decode(hash); } hash_ = hash; } else { hash_ = null; } } catch (final URIException e) { LOG.error(e.getMessage(), e); } }
/** * Returns the hash portion of the location URL (the portion following the '#'). * @return the hash portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a> */ @JsxGetter public String getHash() { final boolean decodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HASH_IS_DECODED); String hash = hash_; if (hash_ != null && (decodeHash || hash_.equals(getUrl().getRef()))) { hash = decodeHash(hash); } if (StringUtils.isEmpty(hash)) { if (getBrowserVersion().hasFeature(JS_LOCATION_HASH_RETURNS_HASH_FOR_EMPTY_DEFINED) && getHref().endsWith("#")) { return "#"; } } else if (getBrowserVersion().hasFeature(JS_LOCATION_HASH_HASH_IS_ENCODED)) { return "#" + UrlUtils.encodeHash(hash); } else { return "#" + hash; } return ""; }
/** * Returns the hash portion of the location URL (the portion following the '#'). * @return the hash portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a> */ @JsxGetter public String getHash() { final boolean decodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HASH_IS_DECODED); String hash = hash_; if (hash_ != null && (decodeHash || hash_.equals(getUrl().getRef()))) { hash = decodeHash(hash); } if (StringUtils.isEmpty(hash)) { if (getBrowserVersion().hasFeature(JS_LOCATION_HASH_RETURNS_HASH_FOR_EMPTY_DEFINED) && getHref().endsWith("#")) { return "#"; } } else if (getBrowserVersion().hasFeature(JS_LOCATION_HASH_HASH_IS_ENCODED)) { return "#" + UrlUtils.encodeHash(hash); } else { return "#" + hash; } return ""; }
/** * Returns the pathname portion of the location URL. * @return the pathname portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a> */ @JsxGetter public String getPathname() { if (WebClient.URL_ABOUT_BLANK == getUrl()) { if (getBrowserVersion().hasFeature(URL_ABOUT_BLANK_HAS_BLANK_PATH)) { return "blank"; } return "/blank"; } return getUrl().getPath(); }
final boolean encodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HREF_HASH_IS_ENCODED); final String hash = getHash(encodeHash); if (hash != null) {
/** * Returns the pathname portion of the location URL. * @return the pathname portion of the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a> */ @JsxGetter public String getPathname() { if (WebClient.URL_ABOUT_BLANK == getUrl()) { if (getBrowserVersion().hasFeature(URL_ABOUT_BLANK_HAS_BLANK_PATH)) { return "blank"; } return "/blank"; } return getUrl().getPath(); }
final boolean encodeHash = getBrowserVersion().hasFeature(JS_LOCATION_HREF_HASH_IS_ENCODED); final String hash = getHash(encodeHash); if (hash != null) {
/** * Sets the hash portion of the location URL (the portion following the '#'). * * @param oldURL the old URL * @param hash the new hash portion of the location URL */ public void setHash(final String oldURL, String hash) { // IMPORTANT: This method must not call setUrl(), because // we must not hit the server just to change the hash! if (hash != null && !hash.isEmpty() && hash.charAt(0) == '#') { hash = hash.substring(1); } final boolean hasChanged = hash != null && !hash.equals(hash_); hash_ = hash; final String newURL = getHref(); if (hasChanged) { final Window w = getWindow(); final Event event; if (getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT)) { event = new HashChangeEvent(w, Event.TYPE_HASH_CHANGE, oldURL, newURL); } else { event = new Event(w, Event.TYPE_HASH_CHANGE); event.initEvent(Event.TYPE_HASH_CHANGE, false, false); } w.executeEventLocally(event); } }
/** * Sets the hash portion of the location URL (the portion following the '#'). * * @param oldURL the old URL * @param hash the new hash portion of the location URL */ public void setHash(final String oldURL, String hash) { // IMPORTANT: This method must not call setUrl(), because // we must not hit the server just to change the hash! if (hash != null && !hash.isEmpty() && hash.charAt(0) == '#') { hash = hash.substring(1); } final boolean hasChanged = hash != null && !hash.equals(hash_); hash_ = hash; final String newURL = getHref(); if (hasChanged) { final Window w = getWindow(); final Event event; if (getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT)) { event = new HashChangeEvent(w, Event.TYPE_HASH_CHANGE, oldURL, newURL); } else { event = new Event(w, Event.TYPE_HASH_CHANGE); event.initEvent(Event.TYPE_HASH_CHANGE, false, false); } w.executeEventLocally(event); } }
/** * Returns the location URL. * @return the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533867.aspx">MSDN Documentation</a> */ public String jsxGet_href() { final Page page = window_.getWebWindow().getEnclosedPage(); if (page == null) { return UNKNOWN; } try { URL url = page.getWebResponse().getRequestSettings().getUrl(); final boolean encodeHash = !getBrowserVersion().isIE(); final String hash = getHash(encodeHash); if (hash != null) { url = UrlUtils.getUrlWithNewRef(url, hash); } return url.toExternalForm(); } catch (final MalformedURLException e) { LOG.error(e.getMessage(), e); return page.getWebResponse().getRequestSettings().getUrl().toExternalForm(); } }
/** * Returns the location URL. * @return the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533867.aspx">MSDN Documentation</a> */ public String jsxGet_href() { final Page page = window_.getWebWindow().getEnclosedPage(); if (page == null) { return UNKNOWN; } try { URL url = page.getWebResponse().getRequestSettings().getUrl(); final boolean encodeHash = !getBrowserVersion().isIE(); final String hash = getHash(encodeHash); if (hash != null) { url = UrlUtils.getUrlWithNewRef(url, hash); } return url.toExternalForm(); } catch (final MalformedURLException e) { LOG.error(e.getMessage(), e); return page.getWebResponse().getRequestSettings().getUrl().toExternalForm(); } }
/** * Returns the location URL. * @return the location URL * @see <a href="http://msdn.microsoft.com/en-us/library/ms533867.aspx">MSDN Documentation</a> */ public String jsxGet_href() { final Page page = window_.getWebWindow().getEnclosedPage(); if (page == null) { return UNKNOWN; } try { URL url = page.getWebResponse().getRequestSettings().getUrl(); final boolean encodeHash = !getBrowserVersion().isIE(); final String hash = getHash(encodeHash); if (hash != null) { url = UrlUtils.getUrlWithNewRef(url, hash); } return url.toExternalForm(); } catch (final MalformedURLException e) { LOG.error(e.getMessage(), e); return page.getWebResponse().getRequestSettings().getUrl().toExternalForm(); } }