<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Capture Screen Size in Hubl in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721066#M58909</link>
    <description>&lt;P&gt;Ok, well as I say you can't do that eith HubL and if you can't share anymore of what yo're trying to achieve we're at a bit of an impass.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a module for a client before where the hero video had to be different on mobile and achieved it with this use of javascript and module fields&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{%require_js %}
 &amp;lt;script&amp;gt;
function videoSource() {
    if ($(window).width() &amp;lt; 768) {
    $('#hero-video source').attr('src', '{{ module.background.mobile.video }}');
    $('#hero-video').attr('poster', '{{ module.background.mobile.thumbnail.src }}');
   }
   else 
   {
    $('#hero-video source').attr('src', '{{ module.background.desktop.video }}');
    $('#hero-video').attr('poster', '{{ resize_image_url(module.background.desktop.thumbnail.src, 500) }}');                    
   }
   };
   &amp;lt;/script&amp;gt;
{% end_require_js %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I couldn't possibly know if that's anywhere near your use case.&lt;/P&gt;
&lt;HR /&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="profile2022a" style="width: 100px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/71500iE96AB1F9E9E277B9/image-size/small?v=v2&amp;amp;px=200" role="button" title="profile2022a" alt="profile2022a" /&gt;&lt;/span&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Barry Grennan&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Website&lt;/A&gt; | &lt;A href="https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Contact&lt;/A&gt; | &lt;A href="https://www.linkedin.com/in/barrygrennan" target="_blank" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 18:19:29 GMT</pubDate>
    <dc:creator>BarryGrennan</dc:creator>
    <dc:date>2022-11-21T18:19:29Z</dc:date>
    <item>
      <title>Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/719882#M58796</link>
      <description>&lt;P&gt;Is it possible to caputure the browser widow/screen size in Hubl?&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;Is it possible to capture and pass it to Hubl using Javascript?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code is what I've tried so far but&amp;nbsp; Hubl doesn't seem to recognize the javascript.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script type="text/javascript"&amp;gt;
  let swidth = screen.width;
  if (swidth &amp;lt; 1025) {
    console.log("Mobile: Screen width is at least 1025px");
    {% set screensize = "mobile" %}
  } else {
    console.log("Desktop: Screen width is at greater than 1025px");
    {% set screensize = "desktop" %}
  }
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 17:01:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/719882#M58796</guid>
      <dc:creator>johnnyr209</dc:creator>
      <dc:date>2022-11-17T17:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/720090#M58815</link>
      <description>&lt;P&gt;I don't think you'll be able to do this. HubL is server side, so it does it's thing before the page loads.&lt;/P&gt;
&lt;P&gt;JavaScript is client side, so you couldn't pass something back that way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to achieve with it? Maybe there's a different approach you can take&lt;/P&gt;
&lt;HR /&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="profile2022a" style="width: 100px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/71500iE96AB1F9E9E277B9/image-size/small?v=v2&amp;amp;px=200" role="button" title="profile2022a" alt="profile2022a" /&gt;&lt;/span&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Barry Grennan&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Website&lt;/A&gt; | &lt;A href="https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Contact&lt;/A&gt; | &lt;A href="https://www.linkedin.com/in/barrygrennan" target="_blank" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 01:57:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/720090#M58815</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2022-11-18T01:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721000#M58903</link>
      <description>&lt;P&gt;I am trying to capture when a user is on a mobile device or desktop.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 15:09:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721000#M58903</guid>
      <dc:creator>johnnyr209</dc:creator>
      <dc:date>2022-11-21T15:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721050#M58907</link>
      <description>&lt;P&gt;I mean, you can do that with plain javascript at it's most basic you could get the window width:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let width = window.innerWidth;
if (width &amp;gt; 768) {
console.log('not mobile');
}&lt;/LI-CODE&gt;
&lt;P&gt;But as I've said you won't be able to pass that to hubl, that's why I ask what you're trying to achieve.&lt;/P&gt;
&lt;HR /&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="profile2022a" style="width: 100px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/71500iE96AB1F9E9E277B9/image-size/small?v=v2&amp;amp;px=200" role="button" title="profile2022a" alt="profile2022a" /&gt;&lt;/span&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Barry Grennan&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Website&lt;/A&gt; | &lt;A href="https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Contact&lt;/A&gt; | &lt;A href="https://www.linkedin.com/in/barrygrennan" target="_blank" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 16:50:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721050#M58907</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2022-11-21T16:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721064#M58908</link>
      <description>&lt;P&gt;Yes, understood. But Im tryig to find a way for hubspot to recogize mobile vs desktop using hubl possibly without javascrip if possible.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 17:09:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721064#M58908</guid>
      <dc:creator>johnnyr209</dc:creator>
      <dc:date>2022-11-21T17:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Capture Screen Size in Hubl</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721066#M58909</link>
      <description>&lt;P&gt;Ok, well as I say you can't do that eith HubL and if you can't share anymore of what yo're trying to achieve we're at a bit of an impass.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a module for a client before where the hero video had to be different on mobile and achieved it with this use of javascript and module fields&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{%require_js %}
 &amp;lt;script&amp;gt;
function videoSource() {
    if ($(window).width() &amp;lt; 768) {
    $('#hero-video source').attr('src', '{{ module.background.mobile.video }}');
    $('#hero-video').attr('poster', '{{ module.background.mobile.thumbnail.src }}');
   }
   else 
   {
    $('#hero-video source').attr('src', '{{ module.background.desktop.video }}');
    $('#hero-video').attr('poster', '{{ resize_image_url(module.background.desktop.thumbnail.src, 500) }}');                    
   }
   };
   &amp;lt;/script&amp;gt;
{% end_require_js %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I couldn't possibly know if that's anywhere near your use case.&lt;/P&gt;
&lt;HR /&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="profile2022a" style="width: 100px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/71500iE96AB1F9E9E277B9/image-size/small?v=v2&amp;amp;px=200" role="button" title="profile2022a" alt="profile2022a" /&gt;&lt;/span&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Barry Grennan&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Website&lt;/A&gt; | &lt;A href="https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Contact&lt;/A&gt; | &lt;A href="https://www.linkedin.com/in/barrygrennan" target="_blank" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 18:19:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Capture-Screen-Size-in-Hubl/m-p/721066#M58909</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2022-11-21T18:19:29Z</dc:date>
    </item>
  </channel>
</rss>

