diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 3d925b83991..848b243f317 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -430,12 +430,12 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { content::NavigationController::LoadURLParams params(url); GURL http_referrer; - if (options.Get("httpreferrer", &http_referrer)) + if (options.Get("httpReferrer", &http_referrer)) params.referrer = content::Referrer(http_referrer.GetAsReferrer(), blink::WebReferrerPolicyDefault); std::string user_agent; - if (options.Get("useragent", &user_agent)) + if (options.Get("userAgent", &user_agent)) SetUserAgent(user_agent); params.transition_type = ui::PAGE_TRANSITION_TYPED; diff --git a/atom/browser/lib/guest-view-manager.coffee b/atom/browser/lib/guest-view-manager.coffee index 6e3447eece3..43624b891c8 100644 --- a/atom/browser/lib/guest-view-manager.coffee +++ b/atom/browser/lib/guest-view-manager.coffee @@ -68,8 +68,8 @@ createGuest = (embedder, params) -> if params.src opts = {} - opts.httpreferrer = params.httpreferrer if params.httpreferrer - opts.useragent = params.useragent if params.useragent + opts.httpReferrer = params.httpreferrer if params.httpreferrer + opts.userAgent = params.useragent if params.useragent @loadUrl params.src, opts if params.allowtransparency? diff --git a/atom/renderer/lib/web-view/web-view-attributes.coffee b/atom/renderer/lib/web-view/web-view-attributes.coffee index 37002aefc4b..82229aae57b 100644 --- a/atom/renderer/lib/web-view/web-view-attributes.coffee +++ b/atom/renderer/lib/web-view/web-view-attributes.coffee @@ -171,10 +171,10 @@ class SrcAttribute extends WebViewAttribute # Navigate to |this.src|. opts = {} httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue() - if httpreferrer then opts.httpreferrer = httpreferrer + if httpreferrer then opts.httpReferrer = httpreferrer useragent = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_USERAGENT].getValue() - if useragent then opts.useragent = useragent + if useragent then opts.userAgent = useragent guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId) guestContents.loadUrl @getValue(), opts diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index ab7766981dc..e60a7d22799 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -571,9 +571,9 @@ Calling `window.print()` in web page is equivalent to call doesn't need print feature, you can safely remove `pdf.dll` in saving binary size. -### BrowserWindow.loadUrl(url) +### BrowserWindow.loadUrl(url, [options]) -Same with `webContents.loadUrl(url)`. +Same with `webContents.loadUrl(url, [options])`. ### BrowserWindow.reload() @@ -778,9 +778,12 @@ Emitted when a plugin process is crashed. Emitted when the WebContents is destroyed. -### WebContents.loadUrl(url) +### WebContents.loadUrl(url, [options]) * `url` URL +* `options` URL + * `httpReferrer` String - A HTTP Referer url + * `userAgent` String - A user agent originating the request Loads the `url` in the window, the `url` must contains the protocol prefix, e.g. the `http://` or `file://`.