Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws error when page contains no 'HEAD' element #102

Open
GoogleCodeExporter opened this issue Apr 21, 2015 · 4 comments
Open

Throws error when page contains no 'HEAD' element #102

GoogleCodeExporter opened this issue Apr 21, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
  1. Right-Click any image on a webpage
  2. Choose 'Open image in new tab'

What is the expected output? What do you see instead?
  Plug-in should load normally,
  Instead shows error found, 'No property "style" of undefined'

What version of the product are you using? On what operating system?
  v2.3, in Chrome 29.0.1547.66, on Win7 64bit

Please provide any additional information below.

May not be fixable since the information you get from 'head' is needed to 
detect what browser is being used. But I thought I'd mention it anyways.

I got the script to run perfectly for my needs by just setting the vars to what 
would have been detected for Chrome.

Thank you for the wonderful plugin!

Original issue reported on code.google.com by neoj...@gmail.com on 10 Sep 2013 at 11:15

@GoogleCodeExporter
Copy link
Author

Well I tried to reproduce on mine chromium but without any succes. Do you have 
any page where I can see the problem live ? 
Thanks in advance

Original comment by wil...@gmail.com on 17 Sep 2013 at 11:16

@GoogleCodeExporter
Copy link
Author

Unfortunately I have no live examples. I wrote a little script for my own use 
and run it through Tampermonkey.

Here is a link my script would run on though - 
http://lebojct.com/Swift-N-Sure/5-11-13-CarWash/images/01.jpg

If you inspect the page using Chrome you see -

<html>
    <body style="margin: 0px;">
        <img style="-webkit-user-select: none" src="http://lebojct.com/Swift-N-Sure/5-11-13-CarWash/images/01.jpg">
    </body>
</html>

There is a <BODY> element, but there is not a <HEAD> element.

So the plugin breaks around line 10 running the code -
styles = document.getElementsByTagName("head")[0].style

There is no <head> element, so document.getElementsByTagName("head") returns 
null, and then the plugin stops when trying to execute .style on null.

Original comment by neoj...@gmail.com on 17 Sep 2013 at 10:38

@GoogleCodeExporter
Copy link
Author

Ahh hmm ok now i get it :) Still it's weird as a <head></head> element should 
be created internally in browser even if not defined explicite, I need to 
investigate a bit more. Thanks for finding

Original comment by wil...@gmail.com on 18 Sep 2013 at 7:37

@GoogleCodeExporter
Copy link
Author

Ahh I get it, you're using it as/trough extension - in that case a normal 
global context might be slighty different. Still there should be other,easy way 
to append styles crossbrowse mhmm..

Original comment by wil...@gmail.com on 18 Sep 2013 at 7:39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant