• 0

How do I Direct Link to a Javascript Component?


Question

I run a photography / writing website called http://www.shutterscript.com. My photos are hosted off-site at smugmug (http://gallery.shutterscript.com). I have been working over the past few days to make my smugmug gallery and my main site look the same. In the process of discovering CSS (and its steep learning curve) I have run into a problem linking to certain components on my gallery page. The gallery uses javascript heavily and after considerable searching I have been unable to figure out how to link to one of their javascript components. All my search results turn up how to open one of my own links in a javascript window which is not what I am trying to do.

Here is what I want to do exactly:

The following link will take you to one of my photos:

http://gallery.shutterscript.com/gallery/3782986#218041532

If you click the "buy this photo" button directly above the photo it launches this cool javascript window by calling the following command:

java script:addCartSingle(ImageID);

Is there a way I can link directly to this javascript window with an href link?

Thanks in advance.

5 answers to this question

Recommended Posts

  • 0

IT's one sexy front-end when you click on the Buy link, isn't it! Beautiful.

Unfortunately though that window is entirely created using Javascript etc. on the page so it's by no means a trivial task to somehow navigate to a page and make it there. However it depends on exactly what you'll be using this for. If, for example, you just want to link to this Buy screen from another thumbnail on your site (outside the Gallery), and then have that load this page and automatically pop open the Buy window, that is something that IS possible.

Bit of clarification of why you want to do this, and I'm sure we can come up with a solution :)

  • 0

Rob, thanks for your reply. It definitely is a sexy front end.

Let me explain a bit further what I'm trying to do. On my main website, www.shutterscript.com I want to link to photos that are hosted on my gallery page (i.e. smugmug). Right now I do the following:

<a href="http://gallery.shutterscript.com/gallery/3781394#219133211-A-LB" title="Buy"><img src="http://gallery.shutterscript.com/photos/219133211-M.jpg" alt="Rights of Passage" ></a>

However, that only takes me to the photo page and not the shopping cart. I somehow want a user to be able to click on a thumbnail on my main site and then get redirected to the smugmug shopping cart for that photo. That would involve going to the link I noted above, then invoking this javascript function "java script:addCartSingle(ImageID);" with the appropriate image ID. I want to bypass the photo page and go directly to the shopping cart in order to reduce the number of steps users need to take in order to purchase a photo.

  • 0

Here's the source html from the photo page that calls the shopping cart:

<span class="title">buy:</span>

<div class="singleImageBuyLinks" style="display: inline">

<a href="java script:addCartSingle(ImageID);" class="nav"><span class="extraNav">this </span>photo</a>

<a href="java script:addCartSingle(ImageID);"><img src="/img/spacer.gif" alt="buy this photo" title="buy this photo" width="21" height="18" hspace="0" vspace="0" border="0" class="cart_add" /></a>

I somehow need to add a link that takes me to the hyperlink (http://gallery.shutterscript.com/gallery/3781394#219133211-A-LB) first, then does the above:

  • 0

I'm assuming this isn't possible, would violate cross site scripting stuff.

What i'm assuming is you want to be able to link to a page, then run commands on that page, if so that isn't possible (uless the page you're linking to is on your site, same domain)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • At some point, hardware becomes obsolete and we cant blame vendors for dropping support. Much of the models dropped, run Intel hardware which means they can install something else on the device if they truly want to keep using it.
    • Well, that was fun: PS C:\WINDOWS\system32> Install-Script -Name Set-InetpubFolderAcl WARNING: Unable to download from URI 'https://go.microsoft.com/fwlin...627338&clcid=0x409' to ''. WARNING: Unable to download the list of available providers. Check your internet connection. PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21 + ... $null = PackageManagement\Install-PackageProvider -Name $script:N ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7474 char:21 + ... $null = PackageManagement\Import-PackageProvider -Name $script:Nu ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (NuGet:String) [Import-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider WARNING: Unable to download from URI 'https://go.microsoft.com/fwlin...627338&clcid=0x409' to ''. WARNING: Unable to download the list of available providers. Check your internet connection. PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider -ListAvailable'. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7478 char:30 + ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvider], Exceptio n + FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider Install-Script : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed. At line:1 char:1 + Install-Script -Name Set-InetpubFolderAcl + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: ( [Install-Script], InvalidOperationException + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Script
    • Because Apple has never discontinued Mac models before now?
    • I recall reading that they intend to synchronize the version numbers between iOS, tvOS and macOS, so we will also be getting macOS 26 up next.
    • every time.... why can't I install windows 11 on my 8088?
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      489
    2. 2
      +FloatingFatMan
      257
    3. 3
      snowy owl
      247
    4. 4
      ATLien_0
      223
    5. 5
      +Edouard
      190
  • Tell a friend

    Love Neowin? Tell a friend!