Jump to content

How to Find if Link is HTTP or other protocol ?


 Share

Recommended Posts

You can use _IELinkGetCollection to get all the links on a page. This example on the helpfile shows how to get the link out of the object. From their you can parse it and check whether it is HTTP or HTTPS. :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

You can use _IELinkGetCollection to get all the links on a page. This example on the helpfile shows how to get the link out of the object. From their you can parse it and check whether it is HTTP or HTTPS. :)

Yes, but this gives all the links which some are HTTP and others are HTTPS. How can I find the state for my specific link ?

Link to comment
Share on other sites

Find the specific link in that collection, then put the string into a variable. You can use StringReplace or StringInStr to do this, then take the whole path and parse out the HTTP or HTTPS. I would first search for HTTPS then HTTP as searching for HTTP and if it is 'HTTPS' it will find it, so searching for the HTTPS would be best.

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

_IENavigate using a hidden external window and get the address from that, close the window, parse the string for the HTTPS or HTTP. :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Find the specific link in that collection, then put the string into a variable. You can use StringReplace or StringInStr to do this, then take the whole path and parse out the HTTP or HTTPS. I would first search for HTTPS then HTTP as searching for HTTP and if it is 'HTTPS' it will find it, so searching for the HTTPS would be best.

:) This method doesn't work as I said, if you try this example, I mean with the "autoitscript.com" link, this link WON'T APPEAR in the listed links ! So even if I search for it, it will find nothing !  :

; Open browser with basic example, get link collection,
; loop through items and display the associated link URL references

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate( "autoitscript.com" )
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended

Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
    $sTxt &= $oLink.href & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)
Link to comment
Share on other sites

Omg dude, Ive said I don't have the FULL link, only the stub of it ! :ermm:

If I would had the FULL link ofcourse I wouldn't ask this, pls read carefully o:)

What you say in your own head is no good to the forum.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

_IENavigate using a hidden external window and get the address from that, close the window, parse the string for the HTTPS or HTTP. :)

Ok so I open hidden IE window running the stub link, and I will read the address bar with the AutoIt methods... seems it would do the job..

But I can't also find if its http or https from the source code of the page ?

Link to comment
Share on other sites

Use the .protocol object method on the internet explorer object created in your hidden IE window. Just like you got the .href you want the protocol of the object.

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...