Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   General Business Knowledge (http://www.greenguysboard.com/board/forumdisplay.php?f=10)
-   -   New HTML Coding For Images - Why? (http://www.greenguysboard.com/board/showthread.php?t=69267)

Greenguy 2018-02-10 09:43 AM

New HTML Coding For Images - Why?
 
I use a Chrome Extension called Image Downloader which is EXTREMELY helpful when you want to grab the image of a movie to make a thumb & right click/save image as doesn't work. But lately it stopped working on a couple of sponsors, so I had to do it the hard way (view source, find the URL of the image, select the URL, right click, select go to...) and when I did, I saw this:

Score Cash - http://www.xlgirls.com/bbw-videos/Mi...LjAuMC4wLjAuMA
Code:


Nubiles - http://nubilefilms.com/galleries/cum...1&coupon=10277
Code:


See how the URL for the images (in BOLD) are coded without the http: or https: while still having the domain & // before it? Any idea why this is?

My 1st thought was that, after asking Mojo about going https yesterday & being advised that calling images from non-secure URLs would set off an alarm, this might be a way around that. But while the Nubiles example isn't secure:
Works: http://images.nubilefilms.com/films/.../cover1280.jpg
Doesn't Work: https://images.nubilefilms.com/films.../cover1280.jpg
The Score Cash example work either way:
http://cdn.scoreuniverse.com/modeldi...7707_x_800.jpg
https://cdn.scoreuniverse.com/modeld...7707_x_800.jpg
That still could be why it's being used, but, as usual, I defer to those that are more tech savvy than me :)

Mud 2018-02-10 11:10 AM

Those are called protocol-relative urls. They will automatically load either from http or https depending if you use the secure version of the website or not.

If you put a http image on a https page you will get a security warning and the image wont load.

Greenguy 2018-02-10 11:49 AM

Quote:

Originally Posted by Mud (Post 549974)
If you put a http image on a https page you will get a security warning and the image wont load.

So is that a workaround where you can load an image from a non-secure URL onto a secure page?

sarettah 2018-02-10 03:28 PM

They are scheme relative urls.

https://stackoverflow.com/questions/...-relative-urls

Quote:

Scheme relative URLs (network-path references) are something that I've just found out about - where you don't specify the scheme of a URL and it picks it up from the current context.

For example: will resolve to https://domain.com/img.png if the current scheme is HTTPS or http://domain.com/img.png if it is not.

This seems like a very easy way to resolve those pesky problems of calling an external script or image on an SSL page without bringing up the dreaded error that some content on a page is not secure.

The benefit seems obvious, but what I don't seem to be able to find is a huge amount of information on this and was wondering if anyone had any experience or references about scheme relative URLs (good or bad)?


This article references an article from 2010 telling people to use scheme ralative but was updated in 2016 to tell you why it is bad to use them:

https://jeremywagner.me/blog/stop-us...-relative-url/

Quote:

Paul Irish has since changed his stance, and now advises against using this URL scheme to reference cross-origin resources. His rationale is that while using the scheme on HTTPS pages is safe, the reverse is not true. Using the scheme on a non-secure page will retrieve cross-origin assets in a non-secure fashion. This isn't good, and it's rather easy to just slap an https:// protocol on your URLs to ensure that your site is completely secure.

.

Greenguy 2018-02-10 04:07 PM

Thank you!

Toby 2018-02-10 05:07 PM

I assume you're pulling images from a different domain than the source page. If not, just use relative rather than absolute links.

Greenguy 2018-02-10 06:27 PM

Quote:

Originally Posted by Toby (Post 549981)
I assume you're pulling images from a different domain than the source page. If not, just use relative rather than absolute links.

My HTML coding skills aren't THAT bad! Hell, it's been a long time since code like this was on my site|lol|


Toby 2018-02-10 09:33 PM

Not what I was saying...

Let's say the web page is in the root directory of https://www.greenguysite.com (could be http:// as well)
If the images are stored in a folder named images then a relative image URL would looks like:
Code:


as opposed to an absolute image url:
Code:


The two sponsor examples you posted are pulling images from a subdomain, so the relative url isn't an option.

Greenguy 2018-02-10 10:08 PM

Quote:

Originally Posted by Toby (Post 549983)
Not what I was saying....

Oh, I knew what you were saying lol. I was just patting myself on the back for not using while pointing out an old newbie mistake that we used to see ALL the time back in the day :)


All times are GMT -4. The time now is 08:26 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc