Changes

Jump to navigation Jump to search

Embedded Iframe

170 bytes added, 08:20, 7 June 2022
[[Category:Widgets]]
[[Category:Troubleshooting]]
<div class="heading">Iframe iFrame Generator</div> This page is about the menu {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS > IFRAME iFrame GENERATOR and explains how to embed the booking page into a web site.
<span style="color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span> Using iFrames are convenient but may have a sub optimal usability experience. Consider opening the booking page in a new tab instead of embedding it in an iFrame.
 =Generate Code SnippetUsing an iFrame=Set Ising iFrames are convenient but may have a sub optimal usability experience. Consider opening the booking page in a new tab instead of embedding it in an iFrame. If you want to use an iFrame set the your parameters in the Iframe iFrame Generator then click on "Get Code". Paste this code into the source code of your website.
<span style="color: #f3e504; font-size: 250%;" >{{#fas:lightbulb}} </span> Do not change the default settings for "Opening Checkin Date", "Length of Stay" and "Number of Guests" if you want to redirect from a widget to an embedded booking page.
<span style="color:#fe746c;“ >{{#fas:exclamation-triangle}} </span>The solution requires that your website can have additional parameters added to your page URL without affecting their ability to load.
 
The principle here is to open your URL containing the iFrame directly with the booking page parameters added to your URL after a ?. The supplied script installed on your page will pass these URL parameters through to the iFrame which will apply them to the booking page within the iFrame.
'''Step 1: Customize the widget'''
Go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS
*Set the value of the “formAction” parameter to be the full URL of the page containing the iFrame. This will cause the booking widget to take the visitor directly to the page with the iFrame and will add the data from the booking widget to the URL as additional parameters
*Customize the widget according to your requirements
'''Step 3: Customize the iFrame'''
Go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS > EMBEDDED IFRAME iFrame and set
*"Opening Checkin Date" = Default
*"Length of Stay " = Default
*Click on "Get Code"
*Copy the code
*Change the element '''src''' to be called '''data-src'''*Add and leave the new elements ''' ouriframe''' and "src=””" as follows so URL the same. There should be no scr in the iFrame starts like '''<iframe ourIframe src="" , the new data-src element should follow src=”” after a spacescript will add it.
Example:
<span style="background-color: #f8f9fa; border: 1px solid #eaecf0;border-radius: 2px; padding: 1px 4px;"><iframe ourIframe src=”” data-src="https://beds24.com/booking2.php?propid=12345&amp;referer=iframe" width="800" height="2000" style="max-width:100%;border:none;overflow:auto;"><p><a href="https://beds24.com/booking2.php?propid=12345&amp;referer=iframe" title="Book Now">Book Now</a></p></iframe></span>
'''Step 45: Install the iFrame and script on your website'''
*Paste the modified code snipped into the HTML of your website where you want show the iFrame
*Add the following script directly after the iFrame end tag </iframeiFrame>
 
Example:
<div style="background-color: #f8f9fa !important; border: 1px solid #eaecf0;border-radius: 2px; padding: 1px 4px;">
<span style="background-color: #f8f9fa; border: 1px solid #eaecf0;border-radius: 2px; padding: 1px 4px;"><nowiki><iFrame data-src="https://beds24.com/booking2.php?propid=12345&amp;referer=iFrame" width="800" height="2000" style="max-width:100%;border:none;overflow:auto;"><p><a href="https://beds24.com/booking2.php?propid=12345&amp;referer=iFrame" title="Book Now">Book Now</a></p></iFrame></nowiki></span>
 
 
<script>
<nowiki>
var addUrlParamsToIframeSrcs = function () { const validParameters = ["checkin","checkout","numnight","numadult","numchild","ownerid","propid","roomid","referer","redirect","lang","group","nogroup","category1","category2","category3","category4", "customParameter"]; const iframeAttrIdentifier = "ourIframe"; const currentUrl = new URL(window.location.href); let parametersString = ""; validParameters.forEach(parameter => { const parameterValue = currentUrl.searchParams.get(parameter); if (parameterValue !== null) { parametersString += "&" + parameter + "=" + parameterValue; } }); const iframes = document.getElementsByTagName("iframe"); for (let iframe of iframes) { if (iframe.getAttribute(iframeAttrIdentifier) !== null) { let iframeSrc = iframe.getAttribute("data-src"); if (iframeSrc === null) { continue; } if (!iframeSrc.includes("?")) { iframeSrc += "?"; } iframeSrc += parametersString; iframe.setAttribute("src", iframeSrc) } }}; addUrlParamsToIframeSrcs();
</nowiki>
</script>
=Multiple Properties=
Set "Properties" = All to create a booking an Iframe iFrame Code for a multiple property booking page. The multiple property booking page.
When a guest clicks on "Book" for one of the listed properties they will be taken to the property booking page where they can book.
If you you have embedded property booking pages as well and want to redirect the guest to this page go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING PAGE > BEHAVIOUR and set "Booking Redirect" = "Multiple Property Only" and enter the URL of the property booking page followed by the redirect destination in "Booking Redirect Url" like this:
<code><nowiki> https://beds24.com/booking.php?propid=12341&redirect=https://www.mywebsite/propertyA</nowiki></code>
==Scrollbar ==
There are two possible reasons for a scrollbar to appear:
1. The Iframe iFrame has not enough height for the content. Raise the value in the <code>height</code> parameter in the booking. For example in this link the height is 1500 (height="1500"):
<code><nowiki><iframe iFrame style="max-width: 100%; border: none; overflow: auto;" src="https://www.beds24.com/booking2.php?propid=3103&amp;numdisplayed=5&amp;numnight=1&amp;numadult=2-1&amp;referer=iframeiFrame/" height="1500" width="800"></iframeiFrame></nowiki></code>
2. The container on your website which holds the Iframe iFrame does not have enough height.
==Dates and/or numbers of guests do not transport from widget ==
This happens when you specify the dates and/or number of guests in the URL. Remove the <code>numadult</code> and <code>advancedays</code> parameters from the URL of the IframeiFrame.
Also make sure that the widget has the same options guest selection as the booking page.
<span style="color:#fe746c;“ >{{#fas:exclamation-triangle}} </span> If you allow guests to book multiple rooms on your booking page the number of guests will never transport from the widget.
==Scroll Iframe iFrame to the top ==When a long page inside an Iframe iFrame changes to a shorter page, the guest viewing the page might be left at the bottom looking at what appears to be a blank page.Possibilities to access and control the Iframe iFrame from outside (your website) are limited.
Try adding onload="window.parent.parent.scrollTo(0,0)" to the IframeiFrame. For example:
<code><nowiki><iframe iFrame onload="window.parent.parent.scrollTo(0,0)" style="max-width: 100%; border: none; overflow: auto;" src="https://www.beds24.com/booking2.php?propid=3103&amp;numdisplayed=5&amp;numnight=1&amp;numadult=2-1&amp;referer=iframeiFrame/" height="1500" width="800"></iframeiFrame></nowiki></code>
*Reduce the height of the embedded booking page or the IframeiFrame. Keeping the Iframe iFrame small and allowing scroll bars to navigate inside it can work well.
==Page is insecure==
==Bottom of the page is blank==
When a long page inside an Iframe iFrame changes to a shorter page, the guest viewing the page might be left at the bottom looking at what appears to be a <b>blank page</b>. [[Scroll_Iframe_to_the_top_of_the_pageScroll_iFrame_to_the_top_of_the_page|Read this help document]] to learn about solutions for this problem.
==Display problems on mobile==
If content is cut off you most likely have not enough width or height in the holding container. Increase either the width and height or try using a smaller font size.
Iframes iFrames on mobile devices are problematic. Make sure you have following code in the <head>: <meta name="viewport" content="width=device-width, initial-scale=1">. If you use the booking page in an Iframe iFrame we recommend you set up a special mobile page for the page where you have embedded the Iframe iFrame which opens the booking page in a new page instead of an IframeiFrame.
==Google Map not showing==
2,819

edits

Navigation menu